2021-06-25 14:46:02 +02:00
|
|
|
module PgMock {
|
|
|
|
const pg: any = {}
|
|
|
|
|
|
|
|
const query = jest.fn(() => ({
|
|
|
|
rows: [
|
|
|
|
{
|
|
|
|
a: "string",
|
|
|
|
b: 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}))
|
|
|
|
|
2022-01-20 09:17:08 +01:00
|
|
|
// constructor
|
|
|
|
function Client() {}
|
2021-06-25 14:46:02 +02:00
|
|
|
|
|
|
|
Client.prototype.query = query
|
|
|
|
Client.prototype.connect = jest.fn()
|
|
|
|
Client.prototype.release = jest.fn()
|
|
|
|
|
2021-10-27 18:21:29 +02:00
|
|
|
const on = jest.fn()
|
2021-06-25 14:46:02 +02:00
|
|
|
|
|
|
|
pg.Client = Client
|
|
|
|
pg.queryMock = query
|
2021-10-27 18:21:29 +02:00
|
|
|
pg.on = on
|
2021-06-25 14:46:02 +02:00
|
|
|
|
|
|
|
module.exports = pg
|
|
|
|
}
|