SSR-600 Updated unit tests for duplicate changes

This commit is contained in:
Josh Dassinger 2024-03-07 11:29:26 -06:00
parent 3cc2c4fd89
commit 01cde2f86c
2 changed files with 17 additions and 13 deletions

View file

@ -136,7 +136,8 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
Text: duplicateOrderText,
Name: referralNumber,
SubText: expectedSubtext
SubText: expectedSubtext,
value: useMainStore().applicationUser.duplicateOrders[0]
});
});
test('duplicateOrder in store with null vehicle make => returns order with only date subtext', () => {
@ -173,7 +174,8 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
Text: duplicateOrderText,
Name: referralNumber,
SubText: expectedSubtext
SubText: expectedSubtext,
value: useMainStore().applicationUser.duplicateOrders[0]
});
});
test('duplicateOrder in store with null vehicle model => returns order with only date subtext', () => {
@ -210,7 +212,8 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
Text: duplicateOrderText,
Name: referralNumber,
SubText: expectedSubtext
SubText: expectedSubtext,
value: useMainStore().applicationUser.duplicateOrders[0]
});
});
test('duplicateOrder in store with all vehicle info => returns order with year, make, model and date in subtext', () => {
@ -248,7 +251,8 @@ describe('duplicateCheck.vue', () => {
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
Text: duplicateOrderText,
Name: referralNumber,
SubText: `${expectedVehicle}, ${expectedDate}`
SubText: `${expectedVehicle}, ${expectedDate}`,
value: useMainStore().applicationUser.duplicateOrders[0]
});
});
});
@ -352,7 +356,7 @@ describe('duplicateCheck.vue', () => {
test('Selected duplicate => load session called', async () => {
// Arrange
const newOrderSelectionName = getRandomString(6, 6);
const selectedAnswer = getRandomString(6, 6);
const selectedAnswer = {};
const mountOptions = getMountOptions({
router: { navigate: jest.fn() }
@ -405,7 +409,7 @@ describe('duplicateCheck.vue', () => {
test('Load session throws error => still navigate forward', async () => {
// Arrange
const newOrderSelectionName = getRandomString(6, 6);
const selectedAnswer = getRandomString(6, 6);
const selectedAnswer = {};
const mountOptions = getMountOptions({
router: { navigate: jest.fn() }

View file

@ -127,16 +127,16 @@ export default {
* @summary Steps to perform when forward button clicked.
*/
async forwardButtonAction() {
if (typeof this.selectedAnswer === 'string' && this.selectedAnswer === this.getNewOrderSelectionName) {
this.navigateForward();
if (this.selectedAnswer !== null && typeof this.selectedAnswer === 'object') {
await useMainStore().loadSession(this.selectedAnswer)
.catch(() => {})
.finally(() => {
this.navigateForward();
});
return;
}
await useMainStore().loadSession(this.selectedAnswer)
.catch(() => {})
.finally(() => {
this.navigateForward();
});
this.navigateForward();
},
navigateForward() {
if (!this.mainStore.order.policy.policyLookupSuccessful) {