add/update tests for navigation
This commit is contained in:
parent
56ae1c3d26
commit
48f704f6ea
1 changed files with 51 additions and 2 deletions
|
|
@ -140,13 +140,62 @@ describe('policy-vehicles.vue', () => {
|
||||||
|
|
||||||
test(
|
test(
|
||||||
// eslint-disable-next-line max-len
|
// eslint-disable-next-line max-len
|
||||||
'Selected VIN matches vehicle listed in system and policy vehicle has endorsements => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
|
'Selected VIN matches vehicle listed in system and policy vehicle has Educator endorsement => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
|
||||||
async () => {
|
async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
const vin = getRandomString(17, 17);
|
const vin = getRandomString(17, 17);
|
||||||
const endorsements = [getRandomString(10, 20)];
|
const endorsements = ['Educator'];
|
||||||
|
await wrapper.setData({
|
||||||
|
selectedVehicleVin: vin,
|
||||||
|
policyVehicles: [
|
||||||
|
{
|
||||||
|
vin,
|
||||||
|
endorsements
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const year = getRandomInt(1998, 2023);
|
||||||
|
const lookupVehicleResponse = {
|
||||||
|
data: {
|
||||||
|
year
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const store = useMainStore();
|
||||||
|
store.lookupVehicleByVin.mockReturnValue(Promise.resolve(lookupVehicleResponse));
|
||||||
|
|
||||||
|
const expectedInput = {
|
||||||
|
year,
|
||||||
|
vin,
|
||||||
|
noCoverage: true,
|
||||||
|
deductible: 0,
|
||||||
|
repairWaived: false,
|
||||||
|
endorsements
|
||||||
|
};
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(store.updateVehicle).toHaveBeenCalledWith(expectedInput);
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.CLICKED_FORWARD_WITH_ENDORSEMENTS,
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
test(
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
'Selected VIN matches vehicle listed in system and policy vehicle has Parking Guard endorsement => update vehicle and navigate forward with CLICKED_FORWARD_WITH_ENDORSEMENTS scenario.',
|
||||||
|
async () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
const vin = getRandomString(17, 17);
|
||||||
|
const endorsements = ['Parking Guard'];
|
||||||
await wrapper.setData({
|
await wrapper.setData({
|
||||||
selectedVehicleVin: vin,
|
selectedVehicleVin: vin,
|
||||||
policyVehicles: [
|
policyVehicles: [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue