traintrape-moi/server/test/app.e2e-spec.ts

25 lines
618 B
TypeScript
Raw Permalink Normal View History

2024-12-07 09:24:41 +00:00
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
2024-12-01 11:30:56 +00:00
describe('AppController (e2e)', () => {
2024-12-07 09:24:41 +00:00
let app: INestApplication
2024-12-01 11:30:56 +00:00
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
2024-12-07 09:24:41 +00:00
}).compile()
2024-12-01 11:30:56 +00:00
2024-12-07 09:24:41 +00:00
app = moduleFixture.createNestApplication()
await app.init()
})
2024-12-01 11:30:56 +00:00
it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
2024-12-07 09:24:41 +00:00
.expect('Hello World!')
})
})