feat: implement e2e test for CompanyResolver (#944)

* feat: wip e2e server test

* feat: use github action postgres & use infra for local

* feat: company e2e test

* feat: add company e2e test for permissions

* Simplify server e2e test run

* Fix lint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2023-07-27 18:48:40 +02:00
committed by GitHub
parent 9027406fdf
commit 157e5b9a2e
25 changed files with 655 additions and 59 deletions

View File

@ -1,24 +1,31 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
import request from 'supertest';
import { createApp } from './utils/create-app';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
[app] = await createApp();
});
it('/ (GET)', () => {
afterEach(async () => {
await app.close();
});
it('/healthz (GET)', () => {
return request(app.getHttpServer())
.get('/')
.get('/healthz')
.expect(200)
.expect('Hello World!');
.expect((response) => {
expect(response.body).toEqual({
status: 'ok',
info: { database: { status: 'up' } },
error: {},
details: { database: { status: 'up' } },
});
});
});
});