feat: integrate new modules (#5087)

This commit is contained in:
DarkSky
2023-12-14 09:50:46 +00:00
parent a93c12e122
commit 2b7f6f8b74
26 changed files with 424 additions and 149 deletions

View File

@@ -14,10 +14,16 @@ import {
import { CacheModule } from '../src/cache';
import { Config, ConfigModule } from '../src/config';
import {
collectMigrations,
RevertCommand,
RunCommand,
} from '../src/data/commands/run';
import { EventModule } from '../src/event';
import { DocManager, DocModule } from '../src/modules/doc';
import { QuotaModule } from '../src/modules/quota';
import { PrismaModule, PrismaService } from '../src/prisma';
import { flushDB } from './utils';
import { FakeStorageModule, flushDB } from './utils';
const createModule = () => {
return Test.createTestingModule({
@@ -25,8 +31,12 @@ const createModule = () => {
PrismaModule,
CacheModule,
EventModule,
QuotaModule,
FakeStorageModule.forRoot(),
ConfigModule.forRoot(),
DocModule,
RevertCommand,
RunCommand,
],
}).compile();
};
@@ -45,6 +55,13 @@ test.beforeEach(async () => {
app = m.createNestApplication();
app.enableShutdownHooks();
await app.init();
// init features
const run = m.get(RunCommand);
const revert = m.get(RevertCommand);
const migrations = await collectMigrations();
await Promise.allSettled(migrations.map(m => revert.run([m.name])));
await run.run();
});
test.afterEach.always(async () => {