diff --git a/test/database_provider.spec.ts b/test/database_provider.spec.ts index 85300dee..a7be85fd 100644 --- a/test/database_provider.spec.ts +++ b/test/database_provider.spec.ts @@ -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 + assert.isDefined(testUtils.db) + // @ts-expect-error + assert.isFunction(testUtils.db) + }) })