Skip to content
Snippets Groups Projects
app.controller.spec.ts 715 B
Newer Older
  • Learn to ignore specific revisions
  • 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', () => {
    
      let appController: AppController;
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
    
    
      beforeEach(async () => {
        const module = await Test.createTestingModule({
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
          controllers: [AppController],
        }).compile();
    
        appController = module.get<AppController>(AppController);
    
    Hugo SUBTIL's avatar
    Hugo SUBTIL committed
      });
    
    
      describe('healthcheck', () => {
    
        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
        });
      });
    });