Add test for creating a row through views.
This commit is contained in:
parent
18acaccfcb
commit
e39a5b0d7e
|
@ -551,7 +551,9 @@ describe.each([
|
||||||
expect(row.name).toEqual(`{ "foo": "2023-01-26T11:48:57.000Z" }`)
|
expect(row.name).toEqual(`{ "foo": "2023-01-26T11:48:57.000Z" }`)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe.only("default values", () => {
|
describe("default values", () => {
|
||||||
|
let table: Table
|
||||||
|
|
||||||
describe("string column", () => {
|
describe("string column", () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
table = await config.api.table.save(
|
table = await config.api.table.save(
|
||||||
|
|
|
@ -1022,6 +1022,11 @@ describe.each([
|
||||||
schema: {
|
schema: {
|
||||||
one: { type: FieldType.STRING, name: "one" },
|
one: { type: FieldType.STRING, name: "one" },
|
||||||
two: { type: FieldType.STRING, name: "two" },
|
two: { type: FieldType.STRING, name: "two" },
|
||||||
|
default: {
|
||||||
|
type: FieldType.STRING,
|
||||||
|
name: "default",
|
||||||
|
default: "default",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -1042,11 +1047,13 @@ describe.each([
|
||||||
_viewId: view.id,
|
_viewId: view.id,
|
||||||
one: "foo",
|
one: "foo",
|
||||||
two: "bar",
|
two: "bar",
|
||||||
|
default: "ohnoes",
|
||||||
})
|
})
|
||||||
|
|
||||||
const row = await config.api.row.get(table._id!, newRow._id!)
|
const row = await config.api.row.get(table._id!, newRow._id!)
|
||||||
expect(row.one).toBeUndefined()
|
expect(row.one).toBeUndefined()
|
||||||
expect(row.two).toEqual("bar")
|
expect(row.two).toEqual("bar")
|
||||||
|
expect(row.default).toEqual("default")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("can't persist readonly columns", async () => {
|
it("can't persist readonly columns", async () => {
|
||||||
|
|
Loading…
Reference in New Issue