budibase/packages/server/__mocks__/pg.ts

29 lines
443 B
TypeScript
Raw Normal View History

module PgMock {
const pg: any = {}
const query = jest.fn(() => ({
rows: [
{
a: "string",
b: 1,
},
],
}))
// constructor
function Client() {}
Client.prototype.query = query
2022-04-29 00:24:52 +02:00
Client.prototype.end = jest.fn()
Client.prototype.connect = jest.fn()
Client.prototype.release = jest.fn()
2021-10-27 18:21:29 +02:00
const on = jest.fn()
pg.Client = Client
pg.queryMock = query
2021-10-27 18:21:29 +02:00
pg.on = on
module.exports = pg
}