-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move database test to its own
- Loading branch information
1 parent
9262bea
commit c2233a5
Showing
2 changed files
with
27 additions
and
18 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import knex from 'knex' | ||
import { test } from '@japa/runner' | ||
|
||
import { DatabaseStore } from '../../src/drivers/database.js' | ||
import { configureDatabaseGroupHooks } from '../../test_helpers/index.js' | ||
|
||
const db = knex({ client: 'pg', connection: { user: 'postgres', password: 'postgres' } }) | ||
test.group('Database Driver', (group) => { | ||
configureDatabaseGroupHooks(db, group) | ||
|
||
test('create table with specified tableName', async ({ assert, cleanup }) => { | ||
const store = new DatabaseStore({ | ||
connection: db, | ||
dialect: 'pg', | ||
tableName: 'verrou_my_locks', | ||
}) | ||
|
||
cleanup(async () => { | ||
await db.schema.dropTable('verrou_my_locks') | ||
}) | ||
|
||
await store.save('foo', 'bar') | ||
|
||
const locks = await db.table('verrou_my_locks').select('*') | ||
assert.lengthOf(locks, 1) | ||
}) | ||
}) |
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