Skip to content

Commit

Permalink
test: check if testUtils.db is registered
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien-R44 committed Jan 26, 2024
1 parent cc236e7 commit 15737d9
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/database_provider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,41 @@ test.group('Database Provider', () => {

assert.isFalse(db.manager.isConnected('sqlite'))
})

test('register testUtils.db() binding', async ({ assert }) => {
const ignitor = new IgnitorFactory()
.merge({
rcFileContents: {
providers: [() => import('../providers/database_provider.js')],
},
})
.withCoreConfig()
.withCoreProviders()
.merge({
config: {
database: defineConfig({
connection: 'sqlite',
connections: {
sqlite: {
client: 'sqlite',
connection: { filename: new URL('./tmp/database.sqlite', import.meta.url).href },
migrations: { naturalSort: true, paths: ['database/migrations'] },
},
},
}),
},
})
.create(BASE_URL, { importer: IMPORTER })

const app = ignitor.createApp('web')
await app.init()
await app.boot()

const testUtils = await app.container.make('testUtils')

// @ts-expect-error

Check failure on line 116 in test/database_provider.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck

Unused '@ts-expect-error' directive.

Check failure on line 116 in test/database_provider.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck

Unused '@ts-expect-error' directive.
assert.isDefined(testUtils.db)
// @ts-expect-error

Check failure on line 118 in test/database_provider.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck

Unused '@ts-expect-error' directive.

Check failure on line 118 in test/database_provider.spec.ts

View workflow job for this annotation

GitHub Actions / typecheck

Unused '@ts-expect-error' directive.
assert.isFunction(testUtils.db)
})
})

0 comments on commit 15737d9

Please sign in to comment.