Assist_Design/apps/bff/test/catalog-contract.spec.ts

34 lines
890 B
TypeScript

/// <reference types="jest" />
import request from "supertest";
import { INestApplication } from "@nestjs/common";
import { Test } from "@nestjs/testing";
import { AppModule } from "../src/app.module";
import { parseInternetCatalog } from "@customer-portal/domain/catalog";
describe("Catalog contract", () => {
let app: INestApplication;
beforeAll(async () => {
const moduleRef = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleRef.createNestApplication();
await app.init();
});
afterAll(async () => {
await app.close();
});
it("should return internet catalog matching domain schema", async () => {
const response = await request(app.getHttpServer()).get("/catalog/internet/plans");
expect(response.status).toBe(200);
expect(() => parseInternetCatalog(response.body.data)).not.toThrow();
});
});