Update tests
This commit is contained in:
parent
1ffab7f5d6
commit
60f8bc0450
|
@ -21,15 +21,18 @@ module PgMock {
|
||||||
function Pool() {
|
function Pool() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const on = jest.fn()
|
||||||
Pool.prototype.query = query
|
Pool.prototype.query = query
|
||||||
Pool.prototype.connect = jest.fn(() => {
|
Pool.prototype.connect = jest.fn(() => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return new Client()
|
return new Client()
|
||||||
})
|
})
|
||||||
|
Pool.prototype.on = on
|
||||||
|
|
||||||
pg.Client = Client
|
pg.Client = Client
|
||||||
pg.Pool = Pool
|
pg.Pool = Pool
|
||||||
pg.queryMock = query
|
pg.queryMock = query
|
||||||
|
pg.on = on
|
||||||
|
|
||||||
module.exports = pg
|
module.exports = pg
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,10 @@ describe("Postgres Integration", () => {
|
||||||
config = new TestConfiguration()
|
config = new TestConfiguration()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("calls the connection callback", async () => {
|
||||||
|
expect(pg.on).toHaveBeenCalledWith('connect', expect.anything())
|
||||||
|
})
|
||||||
|
|
||||||
it("calls the create method with the correct params", async () => {
|
it("calls the create method with the correct params", async () => {
|
||||||
const sql = "insert into users (name, age) values ('Joe', 123);"
|
const sql = "insert into users (name, age) values ('Joe', 123);"
|
||||||
await config.integration.create({
|
await config.integration.create({
|
||||||
|
|
Loading…
Reference in New Issue