-
-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: check if testUtils.db is registered
- Loading branch information
1 parent
cc236e7
commit 15737d9
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 GitHub Actions / typecheck
Check failure on line 116 in test/database_provider.spec.ts GitHub Actions / typecheck
|
||
assert.isDefined(testUtils.db) | ||
// @ts-expect-error | ||
Check failure on line 118 in test/database_provider.spec.ts GitHub Actions / typecheck
Check failure on line 118 in test/database_provider.spec.ts GitHub Actions / typecheck
|
||
assert.isFunction(testUtils.db) | ||
}) | ||
}) |