Skip to content

Commit

Permalink
fix testcase?
Browse files Browse the repository at this point in the history
  • Loading branch information
cyri113 committed Sep 17, 2024
1 parent 9b00549 commit ca80759
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion apps/question/src/question.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Test, TestingModule } from '@nestjs/testing';
import { QuestionController } from './question.controller';
import { QuestionService } from './question.service';
import { RmqService } from '@app/common';
import { RmqService, Services } from '@app/common';

// Mock RmqService
class RmqServiceMock {
ack = jest.fn();
}

// Mock TelegramBotService
class TelegramBotServiceMock {
emit = jest.fn();
}

describe('QuestionController', () => {
let controller: QuestionController;

Expand All @@ -22,6 +27,10 @@ describe('QuestionController', () => {
},
},
{ provide: RmqService, useClass: RmqServiceMock },
{
provide: Services.TelegramBot.name,
useClass: TelegramBotServiceMock,
},
],
}).compile();

Expand Down
4 changes: 2 additions & 2 deletions apps/question/src/question.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { EventsInterceptor } from '@app/common/rmq/interceptors/events.intercept
export class QuestionController {
private readonly logger = new Logger(QuestionController.name);
constructor(
private readonly questionServiceService: QuestionService,
private readonly questionService: QuestionService,
@Inject(Services.TelegramBot.name)
private readonly telegramClient: ClientProxy,
) { }
Expand All @@ -28,7 +28,7 @@ export class QuestionController {

const {
data: { label, score },
} = await this.questionServiceService.test(msg);
} = await this.questionService.test(msg);

const text = `${label}: ${score}`;

Expand Down

0 comments on commit ca80759

Please sign in to comment.