Skip to content

Commit

Permalink
Improvement: better way to create database in acceptance test #187
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed Feb 20, 2025
1 parent 651ae39 commit 8beb737
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/acceptance/createApplication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,15 @@ export async function createApplication() {
const app = moduleFixture.createNestApplication();
const orm = moduleFixture.get(MikroORM);

await orm.getSchemaGenerator().dropDatabase();
await orm.getSchemaGenerator().createDatabase();
await orm.getSchemaGenerator().createSchema();
const schemaGenerator = orm.getSchemaGenerator();
try {
await schemaGenerator.createDatabase();
} catch (e) {
console.log('Updating database...');
}

await schemaGenerator.updateSchema();
await schemaGenerator.clearDatabase();
await app.init();

return { app, orm };
Expand Down

0 comments on commit 8beb737

Please sign in to comment.