1
0
Fork 0
mirror of synced 2024-07-04 22:11:23 +12:00

Adding test case.

This commit is contained in:
mike12345567 2023-11-09 18:22:06 +00:00
parent d2e0986ce9
commit 20895cf426

View file

@ -0,0 +1,39 @@
import TestConfig from "../../tests/utilities/TestConfiguration"
import { basicTable } from "../../tests/utilities/structures"
import { Table } from "@budibase/types"
import sdk from "../"
describe("tables", () => {
const config = new TestConfig()
let table: Table
beforeAll(async () => {
await config.init()
table = await config.api.table.create(basicTable())
})
describe("getTables", () => {
it("should be able to retrieve tables", async () => {
await config.doInContext(config.appId, async () => {
const tables = await sdk.tables.getTables([table._id!])
expect(tables.length).toBe(1)
expect(tables[0]._id).toBe(table._id)
expect(tables[0].name).toBe(table.name)
})
})
it("shouldn't fail when retrieving tables that don't exist", async () => {
await config.doInContext(config.appId, async () => {
const tables = await sdk.tables.getTables(["unknown"])
expect(tables.length).toBe(0)
})
})
it("should de-duplicate the IDs", async () => {
await config.doInContext(config.appId, async () => {
const tables = await sdk.tables.getTables([table._id!, table._id!])
expect(tables.length).toBe(1)
})
})
})
})