mirror of
https://github.com/hexastack/hexabot
synced 2025-05-05 21:34:41 +00:00
fix(api): unit tests
This commit is contained in:
parent
be1787ec48
commit
daffdead62
@ -6,6 +6,7 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Model } from 'mongoose';
|
||||
@ -37,7 +38,7 @@ describe('BotStatsRepository', () => {
|
||||
rootMongooseTestModule(installBotStatsFixtures),
|
||||
MongooseModule.forFeature([BotStatsModel]),
|
||||
],
|
||||
providers: [LoggerService, BotStatsRepository],
|
||||
providers: [LoggerService, BotStatsRepository, EventEmitter2],
|
||||
}).compile();
|
||||
botStatsRepository = module.get<BotStatsRepository>(BotStatsRepository);
|
||||
botStatsModel = module.get<Model<BotStats>>(getModelToken('BotStats'));
|
||||
|
@ -7,6 +7,7 @@
|
||||
*/
|
||||
|
||||
import { NotFoundException } from '@nestjs/common';
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { MongooseModule } from '@nestjs/mongoose';
|
||||
import { Test } from '@nestjs/testing';
|
||||
|
||||
@ -44,7 +45,12 @@ describe('ContextVarController', () => {
|
||||
rootMongooseTestModule(installContextVarFixtures),
|
||||
MongooseModule.forFeature([ContextVarModel]),
|
||||
],
|
||||
providers: [LoggerService, ContextVarService, ContextVarRepository],
|
||||
providers: [
|
||||
LoggerService,
|
||||
ContextVarService,
|
||||
ContextVarRepository,
|
||||
EventEmitter2,
|
||||
],
|
||||
}).compile();
|
||||
contextVarController =
|
||||
module.get<ContextVarController>(ContextVarController);
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { Model } from 'mongoose';
|
||||
@ -38,7 +39,7 @@ describe('BlockRepository', () => {
|
||||
rootMongooseTestModule(installBlockFixtures),
|
||||
MongooseModule.forFeature([BlockModel, CategoryModel, LabelModel]),
|
||||
],
|
||||
providers: [BlockRepository, CategoryRepository],
|
||||
providers: [BlockRepository, CategoryRepository, EventEmitter2],
|
||||
}).compile();
|
||||
blockRepository = module.get<BlockRepository>(BlockRepository);
|
||||
categoryRepository = module.get<CategoryRepository>(CategoryRepository);
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Model } from 'mongoose';
|
||||
@ -52,6 +53,7 @@ describe('ContentTypeRepository', () => {
|
||||
findOne: jest.fn(),
|
||||
},
|
||||
},
|
||||
EventEmitter2,
|
||||
],
|
||||
}).compile();
|
||||
blockService = module.get<BlockService>(BlockService);
|
||||
|
@ -6,6 +6,7 @@
|
||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||
*/
|
||||
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter';
|
||||
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { Model } from 'mongoose';
|
||||
@ -40,7 +41,7 @@ describe('ContentRepository', () => {
|
||||
rootMongooseTestModule(installContentFixtures),
|
||||
MongooseModule.forFeature([ContentTypeModel, ContentModel]),
|
||||
],
|
||||
providers: [LoggerService, ContentRepository],
|
||||
providers: [LoggerService, ContentRepository, EventEmitter2],
|
||||
}).compile();
|
||||
contentRepository = module.get<ContentRepository>(ContentRepository);
|
||||
contentModel = module.get<Model<Content>>(getModelToken('Content'));
|
||||
|
Loading…
Reference in New Issue
Block a user