29 lines
443 B
TypeScript
29 lines
443 B
TypeScript
module PgMock {
|
|
const pg: any = {}
|
|
|
|
const query = jest.fn(() => ({
|
|
rows: [
|
|
{
|
|
a: "string",
|
|
b: 1,
|
|
},
|
|
],
|
|
}))
|
|
|
|
// constructor
|
|
function Client() {}
|
|
|
|
Client.prototype.query = query
|
|
Client.prototype.end = jest.fn()
|
|
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
|
|
}
|