Skip to content

Commit

Permalink
test: dropAll for mongo migration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 21, 2024
1 parent 3a356d2 commit 5833775
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"postgres"
],
"dependencies": {
"cordis": "^3.9.2",
"cordis": "^3.11.0",
"cosmokit": "^1.5.2"
}
}
9 changes: 4 additions & 5 deletions packages/core/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export namespace Join2 {

const kTransaction = Symbol('transaction')

export class Database<S = any, C extends Context = Context> extends Service<C> {
export class Database<S = any, C extends Context = Context> extends Service<undefined, C> {
static [Service.provide] = 'model'
static [Service.immediate] = true

public tables: { [K in Keys<S>]: Model<S[K]> } = Object.create(null)
public drivers: Record<keyof any, Driver> = Object.create(null)
public migrating = false
Expand All @@ -56,10 +59,6 @@ export class Database<S = any, C extends Context = Context> extends Service<C> {

private stashed = new Set<string>()

constructor(ctx?: C) {
super(ctx, 'model', true)
}

async connect<T = undefined>(driver: Driver.Constructor<T>, ...args: Spread<T>) {
this.ctx.plugin(driver, args[0] as any)
await this.ctx.start()
Expand Down
1 change: 1 addition & 0 deletions packages/mongo/tests/migration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('@minatojs/driver-mongo/migrate-virtualKey', () => {
})

afterEach(async () => {
await database.dropAll()
fork?.dispose()
logger.level = 2
})
Expand Down

0 comments on commit 5833775

Please sign in to comment.