This commit is contained in:
chyoo
2026-06-22 18:17:02 +09:00
parent 324728304b
commit 62d7f6ae09
122 changed files with 22484 additions and 1 deletions
+39
View File
@@ -0,0 +1,39 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import request from 'supertest';
import { AppModule } from '../src/app.module';
import { PrismaService } from '../src/prisma/prisma.service';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
})
.overrideProvider(PrismaService)
.useValue({
$connect: jest.fn(),
$disconnect: jest.fn(),
$queryRaw: jest.fn().mockResolvedValue([{ '?column?': 1 }]),
})
.compile();
app = moduleFixture.createNestApplication();
await app.init();
});
afterEach(async () => {
await app.close();
});
it('/health (GET)', () => {
return request(app.getHttpServer())
.get('/health')
.expect(200)
.expect(({ body }) => {
expect(body.status).toBe('ok');
});
});
});