SSR-600 Updated unit tests for duplicate changes
This commit is contained in:
parent
3cc2c4fd89
commit
01cde2f86c
2 changed files with 17 additions and 13 deletions
|
|
@ -136,7 +136,8 @@ describe('duplicateCheck.vue', () => {
|
||||||
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
|
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
|
||||||
Text: duplicateOrderText,
|
Text: duplicateOrderText,
|
||||||
Name: referralNumber,
|
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', () => {
|
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({
|
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
|
||||||
Text: duplicateOrderText,
|
Text: duplicateOrderText,
|
||||||
Name: referralNumber,
|
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', () => {
|
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({
|
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
|
||||||
Text: duplicateOrderText,
|
Text: duplicateOrderText,
|
||||||
Name: referralNumber,
|
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', () => {
|
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({
|
expect(wrapper.vm.duplicateOrders[0]).toStrictEqual({
|
||||||
Text: duplicateOrderText,
|
Text: duplicateOrderText,
|
||||||
Name: referralNumber,
|
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 () => {
|
test('Selected duplicate => load session called', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const newOrderSelectionName = getRandomString(6, 6);
|
const newOrderSelectionName = getRandomString(6, 6);
|
||||||
const selectedAnswer = getRandomString(6, 6);
|
const selectedAnswer = {};
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
router: { navigate: jest.fn() }
|
router: { navigate: jest.fn() }
|
||||||
|
|
@ -405,7 +409,7 @@ describe('duplicateCheck.vue', () => {
|
||||||
test('Load session throws error => still navigate forward', async () => {
|
test('Load session throws error => still navigate forward', async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const newOrderSelectionName = getRandomString(6, 6);
|
const newOrderSelectionName = getRandomString(6, 6);
|
||||||
const selectedAnswer = getRandomString(6, 6);
|
const selectedAnswer = {};
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({
|
||||||
router: { navigate: jest.fn() }
|
router: { navigate: jest.fn() }
|
||||||
|
|
|
||||||
|
|
@ -127,16 +127,16 @@ export default {
|
||||||
* @summary Steps to perform when forward button clicked.
|
* @summary Steps to perform when forward button clicked.
|
||||||
*/
|
*/
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
if (typeof this.selectedAnswer === 'string' && this.selectedAnswer === this.getNewOrderSelectionName) {
|
if (this.selectedAnswer !== null && typeof this.selectedAnswer === 'object') {
|
||||||
this.navigateForward();
|
await useMainStore().loadSession(this.selectedAnswer)
|
||||||
|
.catch(() => {})
|
||||||
|
.finally(() => {
|
||||||
|
this.navigateForward();
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await useMainStore().loadSession(this.selectedAnswer)
|
this.navigateForward();
|
||||||
.catch(() => {})
|
|
||||||
.finally(() => {
|
|
||||||
this.navigateForward();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
navigateForward() {
|
navigateForward() {
|
||||||
if (!this.mainStore.order.policy.policyLookupSuccessful) {
|
if (!this.mainStore.order.policy.policyLookupSuccessful) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue