Initial commit of edr-passenger-api alpha version

This commit is contained in:
Stephanos A
2026-05-13 16:58:49 +03:00
parent 199a3eba11
commit 39ba561d8f
113 changed files with 3602 additions and 1035 deletions

View File

@@ -1,10 +1,9 @@
import { INestApplication } from "@nestjs/common";
import { Test, TestingModule } from "@nestjs/testing";
import request from "supertest";
import { INestApplication, ValidationPipe } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import request from 'supertest';
import { AppModule } from '../src/app.module';
import { AppModule } from "../src/app.module";
describe("Passenger API (e2e)", () => {
describe('Passenger API (e2e)', () => {
let app: INestApplication;
beforeAll(async () => {
@@ -13,6 +12,7 @@ describe("Passenger API (e2e)", () => {
}).compile();
app = moduleFixture.createNestApplication();
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
await app.init();
});
@@ -20,7 +20,18 @@ describe("Passenger API (e2e)", () => {
await app.close();
});
it("GET /api/tickets returns a 200 with a list", () => {
return request(app.getHttpServer()).get("/api/tickets").expect(200);
it('GET /stations returns 200', () => {
return request(app.getHttpServer()).get('/stations').expect(200);
});
it('GET /search returns 200', () => {
return request(app.getHttpServer()).get('/search').expect(404); // POST only
});
it('POST /auth/login with bad credentials returns 401', () => {
return request(app.getHttpServer())
.post('/auth/login')
.send({ email: 'nobody@test.com', password: 'wrong' })
.expect(401);
});
});

View File

@@ -0,0 +1,7 @@
{
"moduleFileExtensions": ["js", "json", "ts"],
"rootDir": ".",
"testRegex": ".e2e-spec.ts$",
"transform": { "^.+\\.(t|j)s$": "ts-jest" },
"testEnvironment": "node"
}