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

30 lines
473 B
TypeScript
Raw Normal View History

module PgMock {
const pg: any = {}
const query = jest.fn(() => ({
rows: [
{
a: "string",
b: 1,
},
],
}))
// constructor
2024-03-20 00:29:19 +13:00
const Client = () => {}
Client.prototype.query = query
2022-05-21 05:08:48 +12:00
Client.prototype.end = jest.fn(cb => {
if (cb) cb()
})
Client.prototype.connect = jest.fn()
Client.prototype.release = jest.fn()
2021-10-28 05:21:29 +13:00
const on = jest.fn()
pg.Client = Client
pg.queryMock = query
2021-10-28 05:21:29 +13:00
pg.on = on
module.exports = pg
}