Updated unit tests.
This commit is contained in:
parent
a5830b5aa5
commit
4bccff6562
1 changed files with 108 additions and 16 deletions
|
|
@ -127,7 +127,7 @@ describe('navigation', () => {
|
|||
expect(wrapper.vm.navigateForward).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('if the coverage policy verified navigate forward to policy-vehicle page', async () => {
|
||||
test('if the coverage policy verified navigate forward to vehicle damage page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
|
|
@ -135,14 +135,6 @@ describe('navigation', () => {
|
|||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
const mockvehicles = [
|
||||
{
|
||||
vin: 'TEST_VIN'
|
||||
},
|
||||
{
|
||||
vin: 'TEST_VIN2'
|
||||
}
|
||||
];
|
||||
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
|
|
@ -152,13 +144,12 @@ describe('navigation', () => {
|
|||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
},
|
||||
isCoverageEnabled: true,
|
||||
vehiclesCount: 2,
|
||||
vehiclesFound: mockvehicles
|
||||
isCoverageEnabled: true
|
||||
});
|
||||
|
||||
useMainStore().order.policy.policyNumber = 'p_0001';
|
||||
useMainStore().order.policy.dateOfLoss = '2022-01-28';
|
||||
useMainStore().order.vehicle.policyVehicleId = 0;
|
||||
|
||||
// Act
|
||||
|
||||
|
|
@ -167,10 +158,111 @@ describe('navigation', () => {
|
|||
// Assert
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_POLICY_VERIFIED,
|
||||
undefined,
|
||||
{},
|
||||
{},
|
||||
mockvehicles
|
||||
undefined
|
||||
);
|
||||
});
|
||||
|
||||
test('if the coverage policy unverified navigate forward to vehicle damage page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
await wrapper.setData({
|
||||
firstName: 'KK',
|
||||
lastName: 'KK',
|
||||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
},
|
||||
isCoverageEnabled: true
|
||||
});
|
||||
|
||||
useMainStore().order.policy.policyNumber = 'p_0001';
|
||||
useMainStore().order.policy.dateOfLoss = '2022-01-28';
|
||||
useMainStore().order.vehicle.policyVehicleId = null;
|
||||
|
||||
// Act
|
||||
|
||||
await wrapper.vm.forwardButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_FORWARD_POLICY_UNVERIFIED,
|
||||
undefined
|
||||
);
|
||||
});
|
||||
|
||||
test('if the coverage policy verified navigate back to welcome page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
await wrapper.setData({
|
||||
firstName: 'KK',
|
||||
lastName: 'KK',
|
||||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
},
|
||||
isCoverageEnabled: true
|
||||
});
|
||||
|
||||
useMainStore().order.policy.policyNumber = 'p_0001';
|
||||
useMainStore().order.policy.dateOfLoss = '2022-01-28';
|
||||
useMainStore().order.vehicle.policyVehicleId = 0;
|
||||
|
||||
// Act
|
||||
|
||||
await wrapper.vm.backButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_POLICY_VERIFIED,
|
||||
undefined
|
||||
);
|
||||
});
|
||||
test('if the coverage policy unverified navigate back to vehicle-selection page', async () => {
|
||||
// Arrange
|
||||
const mockRegistrationAddress = {
|
||||
streetAddress: '1234 Main St',
|
||||
city: 'Columbus',
|
||||
state: 'OH',
|
||||
zipCode: '43215'
|
||||
};
|
||||
|
||||
const { wrapper } = setupMocks();
|
||||
|
||||
await wrapper.setData({
|
||||
firstName: 'KK',
|
||||
lastName: 'KK',
|
||||
customerQuestions: {
|
||||
addressQuestions: mockRegistrationAddress
|
||||
},
|
||||
isCoverageEnabled: true
|
||||
});
|
||||
|
||||
useMainStore().order.policy.policyNumber = 'p_0001';
|
||||
useMainStore().order.policy.dateOfLoss = '2022-01-28';
|
||||
useMainStore().order.vehicle.policyVehicleId = null;
|
||||
|
||||
// Act
|
||||
|
||||
await wrapper.vm.backButtonAction();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||
navigationScenarios.CLICKED_BACK_POLICY_UNVERIFIED,
|
||||
undefined
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue