import { Test, TestingModule } from '@nestjs/testing';
import { HttpStatus, INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { HealthcheckController } from './healthcheck.controller';
describe('HealthcheckController', () => {
let controller: HealthcheckController;
let app: INestApplication;
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [HealthcheckController],
}).compile();
app = module.createNestApplication();
controller = module.get<HealthcheckController>(HealthcheckController);
await app.init();
});
afterEach(() => {
jest.clearAllMocks();
});
afterAll(async () => {
await app.close();
});
describe('healthcheck', () => {
it('should return "OK" string', async () => {
const result = controller.healthcheck();
expect(result).toBe('OK');
});
});
});