From e39a5b0d7ecc45b6cfc3bad449f6fcaac55d6d65 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Mon, 15 Jul 2024 16:44:43 +0100 Subject: [PATCH] Add test for creating a row through views. --- packages/server/src/api/routes/tests/row.spec.ts | 4 +++- packages/server/src/api/routes/tests/viewV2.spec.ts | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index c4399560af..8cabdf5e0f 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -551,7 +551,9 @@ describe.each([ expect(row.name).toEqual(`{ "foo": "2023-01-26T11:48:57.000Z" }`) }) - describe.only("default values", () => { + describe("default values", () => { + let table: Table + describe("string column", () => { beforeAll(async () => { table = await config.api.table.save( diff --git a/packages/server/src/api/routes/tests/viewV2.spec.ts b/packages/server/src/api/routes/tests/viewV2.spec.ts index e9853e5dff..3edbc24365 100644 --- a/packages/server/src/api/routes/tests/viewV2.spec.ts +++ b/packages/server/src/api/routes/tests/viewV2.spec.ts @@ -1022,6 +1022,11 @@ describe.each([ schema: { one: { type: FieldType.STRING, name: "one" }, two: { type: FieldType.STRING, name: "two" }, + default: { + type: FieldType.STRING, + name: "default", + default: "default", + }, }, }) ) @@ -1042,11 +1047,13 @@ describe.each([ _viewId: view.id, one: "foo", two: "bar", + default: "ohnoes", }) const row = await config.api.row.get(table._id!, newRow._id!) expect(row.one).toBeUndefined() expect(row.two).toEqual("bar") + expect(row.default).toEqual("default") }) it("can't persist readonly columns", async () => {