Skip to content

Instantly share code, notes, and snippets.

@paulodutra
Created August 12, 2024 02:00
Show Gist options
  • Save paulodutra/04b00b1600c2857264cbd8308a7fab67 to your computer and use it in GitHub Desktop.
Save paulodutra/04b00b1600c2857264cbd8308a7fab67 to your computer and use it in GitHub Desktop.
Controller default test
import { Test, TestingModule } from '@nestjs/testing';
import { TaskController } from './task.controller';
import { TaskService } from './task.service';
import { ModulesModule } from '../modules.module';
import { DatabaseModule } from '@/infrastructure/database/database.module';
describe('TaskController', () => {
let controller: TaskController;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
imports: [ModulesModule, DatabaseModule.forRoot()],
controllers: [TaskController],
providers: [TaskService],
}).compile();
controller = module.get<TaskController>(TaskController);
});
it('should be defined', () => {
expect(controller).toBeDefined();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment