@tsed/platform-test-sdk
Version:
Package to test platform adapter integration with Ts.ED
28 lines (27 loc) • 807 B
JavaScript
import { PlatformTest } from "@tsed/platform-http/testing";
import SuperTest from "supertest";
import { afterAll, beforeAll, expect, it } from "vitest";
export function testCustom404(options) {
class CustomServer extends options.server {
}
let request;
beforeAll(PlatformTest.bootstrap(CustomServer, {
...options,
mount: {
"/rest": []
}
}));
beforeAll(() => {
request = SuperTest(PlatformTest.callback());
});
afterAll(PlatformTest.reset);
it("Scenario 1: GET /", async () => {
const response = await request.get("/").expect(404);
expect(response.body).toEqual({
name: "NOT_FOUND",
message: 'Resource "/" not found',
status: 404,
errors: []
});
});
}