forked from Shared/esg
Added car by motor
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { InquiryType } from '../../src/common/enums/inquiry-type.enum';
|
||||
import { ParsianProvider } from '../../src/providers/implementations/parsian.provider';
|
||||
|
||||
describe('Parsian third-party plate routing', () => {
|
||||
describe('Parsian car inquiry routing', () => {
|
||||
it('uses the one-factor car-by-plate provider path without a national-code lookup', async () => {
|
||||
const inquireCarByPlate = jest.fn().mockResolvedValue({ raw: { policy: true } });
|
||||
const inquireThirdPartyCar = jest.fn();
|
||||
@@ -19,4 +19,25 @@ describe('Parsian third-party plate routing', () => {
|
||||
expect(inquireCarByPlate).toHaveBeenCalledTimes(1);
|
||||
expect(inquireThirdPartyCar).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('routes motor inquiries through the CentInsur motor support path', async () => {
|
||||
const inquireCarByMotor = jest.fn().mockResolvedValue({ raw: { policy: true } });
|
||||
const provider = Object.create(ParsianProvider.prototype) as any;
|
||||
provider.config = {};
|
||||
provider.centInsurCarSupport = { inquireCarByMotor };
|
||||
|
||||
const result = await provider.callProvider(
|
||||
InquiryType.CAR_BY_MOTOR,
|
||||
{ nationalCode: '1234567890', motorNo: '147H0403219' },
|
||||
{ requestId: 'req-2', trackingCode: 'trk-2' },
|
||||
);
|
||||
|
||||
expect(result).toEqual({ raw: { policy: true } });
|
||||
expect(inquireCarByMotor).toHaveBeenCalledWith(
|
||||
{},
|
||||
{ nationalCode: '1234567890', motorNo: '147H0403219' },
|
||||
expect.any(Function),
|
||||
undefined,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user