canina/backend/test/app.e2e-spec.ts
2026-08-06 22:27:56 +03:30

35 lines
981 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';
process.env.JWT_ACCESS_SECRET =
process.env.JWT_ACCESS_SECRET ||
'test_access_secret_32_characters_minimum_entropy';
process.env.JWT_REFRESH_SECRET =
process.env.JWT_REFRESH_SECRET ||
'test_refresh_secret_32_characters_minimum_entropy';
describe('AppController (e2e)', () => {
let app: INestApplication<App>;
beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
app.setGlobalPrefix('api');
await app.init();
});
it('/api/metrics (GET)', () => {
return request(app.getHttpServer()).get('/api/metrics').expect(200);
});
afterEach(async () => {
await app.close();
});
});