From b3d07aa22812ce8f2c5e081572d4e3aeeab6d4e7 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 28 Jun 2024 15:21:39 +0100 Subject: [PATCH] Adding parameterised tests. --- .../src/api/routes/tests/search.spec.ts | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index 872759ac13..2b2542a3b2 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -2109,25 +2109,28 @@ describe.each([ }) }) - describe("special data_ case", () => { - beforeAll(async () => { - table = await createTable({ - name_data_test: { - name: "name_data_test", - type: FieldType.STRING, - }, - }) - await createRows([{ name_data_test: "a" }, { name_data_test: "b" }]) - }) - - it("should be able to query a column with data_ in it", async () => { - await expectSearch({ - query: { - equal: { - ["1:name_data_test"]: "a", + describe.each(["data_name_test", "name_data_test", "name_test_data_"])( + "special (%s) case", + column => { + beforeAll(async () => { + table = await createTable({ + [column]: { + name: column, + type: FieldType.STRING, }, - }, - }).toContainExactly([{ name_data_test: "a" }]) - }) - }) + }) + await createRows([{ [column]: "a" }, { [column]: "b" }]) + }) + + it("should be able to query a column with data_ in it", async () => { + await expectSearch({ + query: { + equal: { + [`1:${column}`]: "a", + }, + }, + }).toContainExactly([{ [column]: "a" }]) + }) + } + ) })