fixed failing trivial unit tests (nest)

main
Inga 🏳‍🌈 2 years ago
parent a3f2054add
commit d585e802a2
  1. 12
      src/screenshots/screenshots.controller.spec.ts
  2. 3
      src/screenshots/screenshots.processor.spec.ts

@ -1,13 +1,23 @@
import { BullModule, getQueueToken } from '@nestjs/bull';
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { ScreenshotsController } from './screenshots.controller'; import { ScreenshotsController } from './screenshots.controller';
import { QUEUE_NAME } from './shared';
describe('ScreenshotsController', () => { describe('ScreenshotsController', () => {
let controller: ScreenshotsController; let controller: ScreenshotsController;
beforeEach(async () => { beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({ const module: TestingModule = await Test.createTestingModule({
imports: [
BullModule.registerQueue({
name: QUEUE_NAME,
}),
],
controllers: [ScreenshotsController], controllers: [ScreenshotsController],
}).compile(); })
.overrideProvider(getQueueToken(QUEUE_NAME))
.useValue({})
.compile();
controller = module.get<ScreenshotsController>(ScreenshotsController); controller = module.get<ScreenshotsController>(ScreenshotsController);
}); });

@ -1,12 +1,13 @@
import { Test, TestingModule } from '@nestjs/testing'; import { Test, TestingModule } from '@nestjs/testing';
import { ScreenshotsProcessor } from './screenshots.processor'; import { ScreenshotsProcessor } from './screenshots.processor';
import { ScreenshotterService } from './screenshotter.service';
describe('ScreenshotsProcessor', () => { describe('ScreenshotsProcessor', () => {
let service: ScreenshotsProcessor; let service: ScreenshotsProcessor;
beforeEach(async () => { beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({ const module: TestingModule = await Test.createTestingModule({
providers: [ScreenshotsProcessor], providers: [ScreenshotsProcessor, ScreenshotterService],
}).compile(); }).compile();
service = module.get<ScreenshotsProcessor>(ScreenshotsProcessor); service = module.get<ScreenshotsProcessor>(ScreenshotsProcessor);

Loading…
Cancel
Save