forked from Yara724/api
26 lines
885 B
TypeScript
26 lines
885 B
TypeScript
import { RequestManagementService } from "./request-management.service";
|
|
|
|
describe("RequestManagementService CAR_BODY insurer client", () => {
|
|
const previousClientId = process.env.CLIENT_ID;
|
|
|
|
afterEach(() => {
|
|
if (previousClientId === undefined) delete process.env.CLIENT_ID;
|
|
else process.env.CLIENT_ID = previousClientId;
|
|
});
|
|
|
|
it("uses the deployment insurer when the processed body lookup has no company id", async () => {
|
|
process.env.CLIENT_ID = "8";
|
|
const service = Object.create(RequestManagementService.prototype) as any;
|
|
service.clientService = {
|
|
findOne: jest.fn().mockResolvedValue({ _id: "body-client-8" }),
|
|
};
|
|
|
|
await expect(
|
|
service.resolveCarBodyPolicyClientId({ companyId: null }),
|
|
).resolves.toBe("body-client-8");
|
|
expect(service.clientService.findOne).toHaveBeenCalledWith({
|
|
clientCode: 8,
|
|
});
|
|
});
|
|
});
|