1
0
Fork 0
mirror of synced 2024-09-08 21:51:58 +12:00
budibase/packages/server/__mocks__/pg.ts
2024-03-19 11:29:19 +00:00

29 lines
473 B
TypeScript

module PgMock {
const pg: any = {}
const query = jest.fn(() => ({
rows: [
{
a: "string",
b: 1,
},
],
}))
// constructor
const Client = () => {}
Client.prototype.query = query
Client.prototype.end = jest.fn(cb => {
if (cb) cb()
})
Client.prototype.connect = jest.fn()
Client.prototype.release = jest.fn()
const on = jest.fn()
pg.Client = Client
pg.queryMock = query
pg.on = on
module.exports = pg
}