From deec1854fb1e54dd912caba7eb6719ff75755043 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Wed, 8 May 2024 16:30:53 -0400 Subject: [PATCH 1/4] change computed to data --- src/iss-components/cart-dropdown/cart-dropdown.vue | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue index d6565c22..d99747a4 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.vue +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -209,13 +209,11 @@ export default { servicePackage: 'ServicePackageTitle', vapsItemDescriptions: 'VapsItemDescriptions' }, - cartItemType + cartItemType, + cartOrder: this.submittedOrder ?? useMainStore().order }; }, computed: { - cartOrder() { - return this.submittedOrder ?? useMainStore().order; - }, deductible() { return getDeductible(this.cartOrder); }, From 861841a68ba1c06240eb60adadd0a04d6712c088 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Wed, 8 May 2024 16:31:05 -0400 Subject: [PATCH 2/4] unit test fix WIP --- .../__snapshots__/cart-dropdown.spec.js.snap | 165 +++++++++++++++++- .../cart-dropdown/cart-dropdown.spec.js | 6 +- 2 files changed, 163 insertions(+), 8 deletions(-) diff --git a/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap b/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap index 37a7a4ee..161f0282 100644 --- a/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap +++ b/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap @@ -2,12 +2,6 @@ exports[`cart-dropdown component initial data rendered as expected 1`] = ` Object { - "availableVaps": Array [], - "cartItemType": Object { - "MOBILE_FEE": "MOBILE FEE", - "RECYCLE_FEE": "RECYCLE FEE", - "VAP": "VAP", - }, "isExpanded": false, "widget": Object { "amountDue": "AmountDueTextWidget", @@ -21,5 +15,164 @@ Object { "subtotal": "SubtotalWidget", "vapsItemDescriptions": "VapsItemDescriptions", }, + "availableVaps": Array [], + "cartItemType": Object { + "MOBILE_FEE": "MOBILE FEE", + "RECYCLE_FEE": "RECYCLE FEE", + "VAP": "VAP", + }, + "cartOrder": Object { + "availableVaps": Array [], + "carrierPhoneNumber": null, + "contactInfo": Object { + "alternativePhone": null, + "emailAddress": null, + "firstName": null, + "homePhone": null, + "lastName": null, + "notesForTechnician": "", + "requestTextUpdates": false, + "servicePhone": null, + }, + "currentDeductible": null, + "customer": Object { + "address": Object { + "city": null, + "state": null, + "streetAddress": null, + "streetAddress2": null, + "zipCode": null, + }, + "emailAddress": null, + "firstName": null, + "lastName": null, + }, + "customerPortalLoginToken": null, + "damage": Object { + "capabilityQuestionAnswers": null, + "glassToReplace": null, + "isRepair": null, + "moldingQuestionAnswers": null, + "numberOfChips": null, + "partQuestionAnswers": null, + }, + "eon": null, + "lineItems": Object { + "feeItems": Array [], + "glassParts": null, + "otherParts": null, + "serverData": null, + "supportingItems": null, + "vaps": null, + }, + "loadedFromDupeCheck": null, + "loadedSessionClearedPreviousData": null, + "originalDeductible": null, + "payment": Object { + "creditCardToken": Object { + "authCode": null, + "billToFirstName": null, + "billToLastName": null, + "billToPostalCode": null, + "cardType": null, + "expMonth": null, + "expYear": null, + "lastFour": null, + "referenceNumber": null, + "subscriptionId": null, + "transReferenceNumber": null, + "transactionId": null, + }, + "insuranceCoverage": Object { + "claimNumber": null, + "coverageStatus": 0, + "isVerified": false, + }, + "isPayInAdvance": null, + "parentAccountNumber": 0, + "payInAdvanceType": null, + "paypalToken": null, + }, + "policy": Object { + "damageCause": null, + "damageCity": null, + "damageState": null, + "dateOfLoss": null, + "deductible": Object { + "repair": null, + "replace": null, + }, + "endorsementQuestionAnswers": Array [], + "endorsements": Array [], + "isDamageGlassOnly": null, + "isITAC": false, + "noCoverage": null, + "policyData": null, + "policyLookupSuccessful": null, + "policyNumber": null, + "policyZipCode": null, + "status": null, + "vehicles": Array [], + }, + "referralCorrelationId": "00000000-0000-0000-0000-000000000000", + "referralDate": null, + "referralNumber": null, + "referralSequenceNumber": null, + "schedule": Object { + "date": null, + "endTime": null, + "jobMaxMinutes": null, + "jobMinMinutes": null, + "routeCode": null, + "startTime": null, + }, + "serviceLocation": Object { + "IsSafeliteProvider": null, + "address": null, + "address2": null, + "appointmentType": null, + "city": null, + "isVehicleProtected": null, + "provider": Object { + "address": Object { + "city": null, + "state": null, + "streetAddress": null, + "zipCode": null, + "zipCodeCtu": null, + }, + "companyName": null, + "phoneNumber": null, + "providerNumber": null, + }, + "searchFilter": null, + "state": null, + "zipCode": null, + "zipCodeCtu": null, + }, + "vehicle": Object { + "carId": null, + "category": null, + "imageColor": null, + "imageUrl": null, + "imageVifNumber": null, + "make": null, + "model": null, + "policyVehicleId": null, + "registration": Object { + "address": null, + "city": null, + "firstName": null, + "lastName": null, + "licensePlate": null, + "state": null, + "zipCode": null, + }, + "style": null, + "vin": null, + "year": null, + }, + "workOrderNumber": null, + }, } `; diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js index 1427ea02..c69e15fb 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.spec.js +++ b/src/iss-components/cart-dropdown/cart-dropdown.spec.js @@ -60,13 +60,15 @@ beforeEach(() => { describe('cart-dropdown component', () => { test('initial data rendered as expected', () => { // Arrange - const { wrapper } = getMountedComponent({ + const mainInitialState = { order: { availableVaps: [] } - }); + }; + const { wrapper } = getMountedComponent(mainInitialState); // Assert + console.log(wrapper.vm.$data); expect(wrapper.vm.$data).toMatchSnapshot(); }); describe('displays', () => { From 69f6ccc3f0883ba4fd805f5d494da5629f3ea61d Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Thu, 9 May 2024 09:26:22 -0400 Subject: [PATCH 3/4] unit test fix --- .../__snapshots__/cart-dropdown.spec.js.snap | 158 +++++++++--------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap b/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap index 161f0282..0a8190fa 100644 --- a/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap +++ b/src/iss-components/cart-dropdown/__snapshots__/cart-dropdown.spec.js.snap @@ -2,19 +2,6 @@ exports[`cart-dropdown component initial data rendered as expected 1`] = ` Object { - "isExpanded": false, - "widget": Object { - "amountDue": "AmountDueTextWidget", - "amountPaid": "AmountPaidTextWidget", - "basePrice": "BasePriceWidget", - "deductible": "DeductibleWidget", - "mobileFee": "MobileServiceWidget", - "recycleFee": "RecycleFeeWidget", - "salesTax": "SalesTaxWidget", - "servicePackage": "ServicePackageTitle", - "subtotal": "SubtotalWidget", - "vapsItemDescriptions": "VapsItemDescriptions", - }, "availableVaps": Array [], "cartItemType": Object { "MOBILE_FEE": "MOBILE FEE", @@ -36,16 +23,16 @@ Object { }, "currentDeductible": null, "customer": Object { - "address": Object { - "city": null, - "state": null, - "streetAddress": null, - "streetAddress2": null, - "zipCode": null, - }, - "emailAddress": null, - "firstName": null, - "lastName": null, + "address": Object { + "city": null, + "state": null, + "streetAddress": null, + "streetAddress2": null, + "zipCode": null, + }, + "emailAddress": null, + "firstName": null, + "lastName": null, }, "customerPortalLoginToken": null, "damage": Object { @@ -70,30 +57,30 @@ Object { "originalDeductible": null, "payment": Object { "creditCardToken": Object { - "authCode": null, - "billToFirstName": null, - "billToLastName": null, - "billToPostalCode": null, - "cardType": null, - "expMonth": null, - "expYear": null, - "lastFour": null, - "referenceNumber": null, - "subscriptionId": null, - "transReferenceNumber": null, - "transactionId": null, + "authCode": null, + "billToFirstName": null, + "billToLastName": null, + "billToPostalCode": null, + "cardType": null, + "expMonth": null, + "expYear": null, + "lastFour": null, + "referenceNumber": null, + "subscriptionId": null, + "transReferenceNumber": null, + "transactionId": null, }, - "insuranceCoverage": Object { - "claimNumber": null, - "coverageStatus": 0, - "isVerified": false, + "insuranceCoverage": Object { + "claimNumber": null, + "coverageStatus": 0, + "isVerified": false, }, "isPayInAdvance": null, "parentAccountNumber": 0, "payInAdvanceType": null, "paypalToken": null, - }, - "policy": Object { + }, + "policy": Object { "damageCause": null, "damageCity": null, "damageState": null, @@ -102,17 +89,17 @@ Object { "repair": null, "replace": null, }, - "endorsementQuestionAnswers": Array [], - "endorsements": Array [], - "isDamageGlassOnly": null, - "isITAC": false, - "noCoverage": null, - "policyData": null, - "policyLookupSuccessful": null, - "policyNumber": null, - "policyZipCode": null, - "status": null, - "vehicles": Array [], + "endorsementQuestionAnswers": Array [], + "endorsements": Array [], + "isDamageGlassOnly": null, + "isITAC": false, + "noCoverage": null, + "policyData": null, + "policyLookupSuccessful": null, + "policyNumber": null, + "policyZipCode": null, + "status": null, + "vehicles": Array [], }, "referralCorrelationId": "00000000-0000-0000-0000-000000000000", "referralDate": null, @@ -133,22 +120,22 @@ Object { "appointmentType": null, "city": null, "isVehicleProtected": null, - "provider": Object { - "address": Object { - "city": null, - "state": null, - "streetAddress": null, - "zipCode": null, - "zipCodeCtu": null, + "provider": Object { + "address": Object { + "city": null, + "state": null, + "streetAddress": null, + "zipCode": null, + "zipCodeCtu": null, + }, + "companyName": null, + "phoneNumber": null, + "providerNumber": null, }, - "companyName": null, - "phoneNumber": null, - "providerNumber": null, - }, - "searchFilter": null, - "state": null, - "zipCode": null, - "zipCodeCtu": null, + "searchFilter": null, + "state": null, + "zipCode": null, + "zipCodeCtu": null, }, "vehicle": Object { "carId": null, @@ -159,20 +146,33 @@ Object { "make": null, "model": null, "policyVehicleId": null, - "registration": Object { - "address": null, - "city": null, - "firstName": null, - "lastName": null, - "licensePlate": null, - "state": null, - "zipCode": null, - }, - "style": null, - "vin": null, - "year": null, + "registration": Object { + "address": null, + "city": null, + "firstName": null, + "lastName": null, + "licensePlate": null, + "state": null, + "zipCode": null, + }, + "style": null, + "vin": null, + "year": null, }, "workOrderNumber": null, }, + "isExpanded": false, + "widget": Object { + "amountDue": "AmountDueTextWidget", + "amountPaid": "AmountPaidTextWidget", + "basePrice": "BasePriceWidget", + "deductible": "DeductibleWidget", + "mobileFee": "MobileServiceWidget", + "recycleFee": "RecycleFeeWidget", + "salesTax": "SalesTaxWidget", + "servicePackage": "ServicePackageTitle", + "subtotal": "SubtotalWidget", + "vapsItemDescriptions": "VapsItemDescriptions", + }, } `; From 835e5e7b270ec927a5bbe916b43cd4c640f48052 Mon Sep 17 00:00:00 2001 From: Katie Kroell Date: Thu, 9 May 2024 09:32:03 -0400 Subject: [PATCH 4/4] remove console log, update unit test --- src/iss-components/cart-dropdown/cart-dropdown.spec.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/iss-components/cart-dropdown/cart-dropdown.spec.js b/src/iss-components/cart-dropdown/cart-dropdown.spec.js index c69e15fb..1427ea02 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.spec.js +++ b/src/iss-components/cart-dropdown/cart-dropdown.spec.js @@ -60,15 +60,13 @@ beforeEach(() => { describe('cart-dropdown component', () => { test('initial data rendered as expected', () => { // Arrange - const mainInitialState = { + const { wrapper } = getMountedComponent({ order: { availableVaps: [] } - }; - const { wrapper } = getMountedComponent(mainInitialState); + }); // Assert - console.log(wrapper.vm.$data); expect(wrapper.vm.$data).toMatchSnapshot(); }); describe('displays', () => {