forked from Yara724/api
Fixed car body inquiry client id fixing
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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,
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user