diff --git a/src/__tests__/client-id.test.ts b/src/__tests__/client-id.test.ts index 0c9dd00..dd1c4c4 100644 --- a/src/__tests__/client-id.test.ts +++ b/src/__tests__/client-id.test.ts @@ -5,22 +5,37 @@ import { appWithClient, tableWithClient } from "./test-common"; jest.mock("cross-fetch", () => jest.fn(jest.requireActual("cross-fetch") as any)); -test("sanity - get named table", async () => { - const table = await appWithClient.getTableNamed("Things"); - const spy = (fetch as jest.Mock).mockImplementationOnce(fetch); - const clientID = spy.mock.calls[0][1]["headers"]["X-Glide-Client-ID"]; - expect(clientID).toBeDefined(); - expect(clientID).toEqual(process.env.GLIDE_CLIENT_ID); - expect(table).toBeDefined(); -}); +describe("client id sanity", () => { + jest.setTimeout(60_000); + + test("get named table", async () => { + const table = await appWithClient.getTableNamed("Things"); + const spy = (fetch as jest.Mock).mockImplementationOnce(fetch); + const clientID = spy.mock.calls[0][1]["headers"]["X-Glide-Client-ID"]; + expect(clientID).toBeDefined(); + expect(clientID).toEqual(process.env.GLIDE_CLIENT_ID); + expect(table).toBeDefined(); + }); + + test("get schema", async () => { + const { + data: { columns }, + } = await tableWithClient.getSchema(); + const spy = (fetch as jest.Mock).mockImplementationOnce(fetch); + const clientID = spy.mock.calls[0][1]["headers"]["X-Glide-Client-ID"]; + expect(clientID).toBeDefined(); + expect(clientID).toEqual(process.env.GLIDE_CLIENT_ID); + expect(columns).toBeDefined(); + }); + + it("can add a row", async () => { + const rowID = await tableWithClient.add({ + name: "Test Item", + renamed: "Test Description", + stock: 100, + }); + expect(rowID).toBeDefined(); -test("sanity - get named table", async () => { - const { - data: { columns }, - } = await tableWithClient.getSchema(); - const spy = (fetch as jest.Mock).mockImplementationOnce(fetch); - const clientID = spy.mock.calls[0][1]["headers"]["X-Glide-Client-ID"]; - expect(clientID).toBeDefined(); - expect(clientID).toEqual(process.env.GLIDE_CLIENT_ID); - expect(columns).toBeDefined(); + await tableWithClient.delete(rowID); + }); });