mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 20:38:17 +00:00
Initial commit of edr-passenger-api alpha version
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user