Skip to content
Snippets Groups Projects
app.controller.spec.ts 715 B
Newer Older
Bastien DUMONT's avatar
Bastien DUMONT committed
import { Test } from '@nestjs/testing';
import { version } from '../package.json';
Hugo SUBTIL's avatar
Hugo SUBTIL committed
import { AppController } from './app.controller';
Hugo SUBTIL's avatar
Hugo SUBTIL committed
describe('AppController', () => {
Bastien DUMONT's avatar
Bastien DUMONT committed
  let appController: AppController;
Hugo SUBTIL's avatar
Hugo SUBTIL committed

Bastien DUMONT's avatar
Bastien DUMONT committed
  beforeEach(async () => {
    const module = await Test.createTestingModule({
Hugo SUBTIL's avatar
Hugo SUBTIL committed
      controllers: [AppController],
    }).compile();
Bastien DUMONT's avatar
Bastien DUMONT committed
    appController = module.get<AppController>(AppController);
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  });

  describe('healthcheck', () => {
Bastien DUMONT's avatar
Bastien DUMONT committed
    it('should return healthcheck', async () => {
      const healthcheck = appController.healthcheck();
      expect(healthcheck.status).toBe('API Online');
      expect(healthcheck.uptime).not.toBeNull();
      expect(healthcheck.version).toBe(version);
Hugo SUBTIL's avatar
Hugo SUBTIL committed
    });
  });
});