From f67173b757eb15204c6aff19d338c52e402d7a99 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 20 Feb 2024 11:35:29 +0000 Subject: [PATCH] Fix flaky table test. --- packages/server/src/api/routes/tests/table.spec.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/server/src/api/routes/tests/table.spec.ts b/packages/server/src/api/routes/tests/table.spec.ts index c8cb3ef21b..ce119e56f0 100644 --- a/packages/server/src/api/routes/tests/table.spec.ts +++ b/packages/server/src/api/routes/tests/table.spec.ts @@ -368,10 +368,12 @@ describe("/tables", () => { .set(config.defaultHeaders()) .expect("Content-Type", /json/) .expect(200) - const fetchedTable = res.body[0] - expect(fetchedTable.name).toEqual(testTable.name) - expect(fetchedTable.type).toEqual("table") - expect(fetchedTable.sourceType).toEqual("internal") + + const table = res.body.find((t: Table) => t._id === testTable._id) + expect(table).toBeDefined() + expect(table.name).toEqual(testTable.name) + expect(table.type).toEqual("table") + expect(table.sourceType).toEqual("internal") }) it("should apply authorization to endpoint", async () => {