mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
Restructure test setup in Note E2E tests to not load the whole application
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
8145fc48d1
commit
c43448624b
1 changed files with 18 additions and 3 deletions
|
@ -1,8 +1,12 @@
|
||||||
import { INestApplication } from '@nestjs/common';
|
import { INestApplication } from '@nestjs/common';
|
||||||
import { Test } from '@nestjs/testing';
|
import { Test } from '@nestjs/testing';
|
||||||
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import * as request from 'supertest';
|
import * as request from 'supertest';
|
||||||
import { AppModule } from '../../src/app.module';
|
import { PublicApiModule } from '../../src/api/public/public-api.module';
|
||||||
|
import { GroupsModule } from '../../src/groups/groups.module';
|
||||||
|
import { NotesModule } from '../../src/notes/notes.module';
|
||||||
import { NotesService } from '../../src/notes/notes.service';
|
import { NotesService } from '../../src/notes/notes.service';
|
||||||
|
import { PermissionsModule } from '../../src/permissions/permissions.module';
|
||||||
|
|
||||||
describe('Notes', () => {
|
describe('Notes', () => {
|
||||||
let app: INestApplication;
|
let app: INestApplication;
|
||||||
|
@ -10,12 +14,23 @@ describe('Notes', () => {
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const moduleRef = await Test.createTestingModule({
|
const moduleRef = await Test.createTestingModule({
|
||||||
imports: [AppModule],
|
imports: [
|
||||||
|
PublicApiModule,
|
||||||
|
NotesModule,
|
||||||
|
PermissionsModule,
|
||||||
|
GroupsModule,
|
||||||
|
TypeOrmModule.forRoot({
|
||||||
|
type: 'sqlite',
|
||||||
|
database: ':memory:',
|
||||||
|
autoLoadEntities: true,
|
||||||
|
synchronize: true,
|
||||||
|
}),
|
||||||
|
],
|
||||||
}).compile();
|
}).compile();
|
||||||
|
|
||||||
app = moduleRef.createNestApplication();
|
app = moduleRef.createNestApplication();
|
||||||
notesService = moduleRef.get(NotesService);
|
|
||||||
await app.init();
|
await app.init();
|
||||||
|
notesService = moduleRef.get(NotesService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`POST /notes`, async () => {
|
it(`POST /notes`, async () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue