Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
app.e2e-spec.ts 750 B
import type { INestApplication } from '@nestjs/common';
import type { TestingModule } from '@nestjs/testing';

import { afterEach, beforeEach, describe, it } from '@jest/globals';
import { Test } from '@nestjs/testing';
import request from 'supertest';

import AppModule from '../src/app.module.js';

describe('AppController (e2e)', () => {
  let app: INestApplication;

  beforeEach(async () => {
    const moduleFixture: TestingModule = await Test.createTestingModule({
      imports: [AppModule],
    }).compile();

    app = moduleFixture.createNestApplication();
    await app.init();
  });

  afterEach(async () => {
    await app.close();
  });

  it('/v1/health (GET)', () =>
    request(app.getHttpServer()).get('/health').expect(200));
});