BingLogyBlog-Backend/test/app.e2e-spec.ts
laobinghu 97f81fd010 On branch main
Initial commit

Changes to be committed:
	new file:   .gitignore
	new file:   .prettierrc
	new file:   LICENSE
	new file:   README.md
	new file:   eslint.config.mjs
	new file:   nest-cli.json
	new file:   package.json
	new file:   pnpm-lock.yaml
	new file:   src/app.controller.spec.ts
	new file:   src/app.controller.ts
	new file:   src/app.module.ts
	new file:   src/app.service.ts
	new file:   src/main.ts
	new file:   test/app.e2e-spec.ts
	new file:   test/jest-e2e.json
	new file:   tsconfig.build.json
	new file:   tsconfig.json
2026-03-27 17:04:59 +08:00

26 lines
669 B
TypeScript

import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { App } from 'supertest/types';
import { AppModule } from './../src/app.module';
describe('AppController (e2e)', () => {
let app: INestApplication<App>;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer())
.get('/')
.expect(200)
.expect('Hello World!');
});
});