Skip to content

Commit 46227bb

Browse files
author
Julien Heller
committed
Fix tests
1 parent 73022c8 commit 46227bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/MigrationRunner.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Docker from 'dockerode'
22
import massive from 'massive'
33
import * as path from 'path'
44
import { IDatabase } from 'pg-promise'
5+
import * as Logger from 'bunyan'
56
import { Migration } from './Migration'
67
import { MigrationRunner } from './MigrationRunner'
78
import * as dockerUtils from './testHelpers/docker'
@@ -14,6 +15,8 @@ const dbPass = 'docker'
1415

1516
const baseDir = path.join(path.resolve('./'), 'src')
1617

18+
const log = Logger.createLogger({ name: 'TestMigrationRunner', level: 'debug' })
19+
1720
class TestMigrationRunner extends MigrationRunner {
1821
public async _checkOrCreateSchema() { await this.checkOrCreateSchema() }
1922
public async _checkOrCreateTables() { await this.checkOrCreateTables() }
@@ -80,6 +83,7 @@ describe('Database setup', () => {
8083
massiveInstance.instance,
8184
[],
8285
'newschema',
86+
log,
8387
)
8488
await runner._checkOrCreateSchema()
8589
await runner._checkOrCreateTables() // Schema needs something inside to be seen by Massive
@@ -91,6 +95,8 @@ describe('Database setup', () => {
9195
const runner = new TestMigrationRunner(
9296
massiveInstance.instance,
9397
[],
98+
'public',
99+
log,
94100
)
95101
await runner.setup()
96102
await massiveInstance.reload()
@@ -105,6 +111,7 @@ describe('Database setup', () => {
105111
massiveInstance.instance,
106112
[],
107113
'doesntexist',
114+
log,
108115
)
109116
const schemaError = Error(
110117
`Schema 'doesntexist' does not exist. Make sure you have run \`setup()\` before migrating`,
@@ -160,6 +167,7 @@ describe('MigrationRunner', () => {
160167
massiveInstance.instance,
161168
migrations,
162169
schemaName,
170+
log,
163171
)
164172
await runner.setup()
165173
await massiveInstance.reload()

0 commit comments

Comments
 (0)