check postgres has been called

This commit is contained in:
Peter Clement 2023-02-03 09:19:27 +00:00
parent cdc55a0c32
commit 8e480ac884
1 changed files with 2 additions and 0 deletions

View File

@ -1,3 +1,4 @@
const pg = require("pg")
jest.mock("pg") jest.mock("pg")
import * as setup from "./utilities" import * as setup from "./utilities"
import { mocks } from "@budibase/backend-core/tests" import { mocks } from "@budibase/backend-core/tests"
@ -126,6 +127,7 @@ describe("/api/env/variables", () => {
a: "string", a: "string",
b: "number", b: "number",
}) })
expect(pg.queryMock).toHaveBeenCalled()
expect(res.body.rows.length).toEqual(1) expect(res.body.rows.length).toEqual(1)
expect(events.query.previewed).toBeCalledTimes(1) expect(events.query.previewed).toBeCalledTimes(1)
expect(events.query.previewed).toBeCalledWith( expect(events.query.previewed).toBeCalledWith(