1
0
Fork 0
mirror of synced 2024-09-11 15:08:05 +12:00
budibase/packages/backend-core/tests/core/utilities/jestUtils.ts

31 lines
743 B
TypeScript
Raw Normal View History

2023-07-26 02:32:26 +12:00
import { db } from "../../../src"
2023-03-01 02:54:34 +13:00
export function expectFunctionWasCalledTimesWith(
jestFunction: any,
times: number,
argument: any
) {
expect(
jestFunction.mock.calls.filter((call: any) => call[0] === argument).length
).toBe(times)
}
2023-07-26 02:32:26 +12:00
export const expectAnyInternalColsAttributes: {
[K in (typeof db.CONSTANT_INTERNAL_ROW_COLS)[number]]: any
} = {
tableId: expect.anything(),
type: expect.anything(),
_id: expect.anything(),
_rev: expect.anything(),
createdAt: expect.anything(),
updatedAt: expect.anything(),
}
export const expectAnyExternalColsAttributes: {
[K in (typeof db.CONSTANT_EXTERNAL_ROW_COLS)[number]]: any
} = {
tableId: expect.anything(),
_id: expect.anything(),
_rev: expect.anything(),
}