mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 09:46:30 -05:00
ControllerTests: Add connection to controller tests
Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
0933b88ff5
commit
258a38f8c0
4 changed files with 32 additions and 4 deletions
|
@ -10,7 +10,11 @@ import { LoggerModule } from '../../../../logger/logger.module';
|
|||
import { UsersModule } from '../../../../users/users.module';
|
||||
import { HistoryModule } from '../../../../history/history.module';
|
||||
import { NotesModule } from '../../../../notes/notes.module';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { User } from '../../../../users/user.entity';
|
||||
import { Note } from '../../../../notes/note.entity';
|
||||
import { AuthToken } from '../../../../auth/auth-token.entity';
|
||||
|
@ -41,8 +45,11 @@ describe('HistoryController', () => {
|
|||
isGlobal: true,
|
||||
load: [appConfigMock],
|
||||
}),
|
||||
TypeOrmModule.forRoot(),
|
||||
],
|
||||
})
|
||||
.overrideProvider(getConnectionToken())
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(User))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Note))
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NotesController } from './notes.controller';
|
||||
import { NotesService } from '../../../notes/notes.service';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
import { Tag } from '../../../notes/tag.entity';
|
||||
import { RevisionsModule } from '../../../revisions/revisions.module';
|
||||
|
@ -61,8 +65,11 @@ describe('NotesController', () => {
|
|||
isGlobal: true,
|
||||
load: [appConfigMock, mediaConfigMock],
|
||||
}),
|
||||
TypeOrmModule.forRoot(),
|
||||
],
|
||||
})
|
||||
.overrideProvider(getConnectionToken())
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Note))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Revision))
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { HistoryModule } from '../../../history/history.module';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { AuthorColor } from '../../../notes/author-color.entity';
|
||||
|
@ -45,8 +49,11 @@ describe('Me Controller', () => {
|
|||
NotesModule,
|
||||
LoggerModule,
|
||||
MediaModule,
|
||||
TypeOrmModule.forRoot(),
|
||||
],
|
||||
})
|
||||
.overrideProvider(getConnectionToken())
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(User))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Note))
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
*/
|
||||
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import {
|
||||
getConnectionToken,
|
||||
getRepositoryToken,
|
||||
TypeOrmModule,
|
||||
} from '@nestjs/typeorm';
|
||||
import { LoggerModule } from '../../../logger/logger.module';
|
||||
import { AuthorColor } from '../../../notes/author-color.entity';
|
||||
import { Note } from '../../../notes/note.entity';
|
||||
|
@ -61,8 +65,11 @@ describe('Notes Controller', () => {
|
|||
isGlobal: true,
|
||||
load: [appConfigMock, mediaConfigMock],
|
||||
}),
|
||||
TypeOrmModule.forRoot(),
|
||||
],
|
||||
})
|
||||
.overrideProvider(getConnectionToken())
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Note))
|
||||
.useValue({})
|
||||
.overrideProvider(getRepositoryToken(Revision))
|
||||
|
|
Loading…
Reference in a new issue