diff --git a/src/layouts/service-location/shop-question/shop-question.spec.js b/src/layouts/service-location/shop-question/shop-question.spec.js index 8fcae10ce..838061f92 100644 --- a/src/layouts/service-location/shop-question/shop-question.spec.js +++ b/src/layouts/service-location/shop-question/shop-question.spec.js @@ -122,171 +122,6 @@ const shopQuestionInitialData = { distance: 19.4618116611001, providerNumber: "003342", }, - { - address: { - city: "ZANESVILLE", - country: "US", - state: "OH", - streetAddress: "3350 MAPLE AVE.", - zipCode: "43701", - }, - distance: 41.9091549795417, - providerNumber: "005819", - }, - { - address: { - city: "ZANESVILLE", - country: "US", - state: "OH", - streetAddress: "903 LINDEN AVE", - zipCode: "43701", - }, - distance: 42.8868847428493, - providerNumber: "004139", - }, - { - address: { - city: "MANSFIELD", - country: "US", - state: "OH", - streetAddress: "1139 PARK AVE W", - zipCode: "44906", - }, - distance: 48.0907606730017, - providerNumber: "006043", - }, - { - address: { - city: "CHILLICOTHE", - country: "US", - state: "OH", - streetAddress: "1415 N BRIDGE ST", - zipCode: "45601", - }, - distance: 50.7481559930212, - providerNumber: "005803", - }, - { - address: { - city: "KENTON", - country: "US", - state: "OH", - streetAddress: "999 MEADOW LN", - zipCode: "43326", - }, - distance: 58.381091106879, - providerNumber: "006041", - }, - { - address: { - city: "WOOSTER", - country: "US", - state: "OH", - streetAddress: "MOBILE ONLY", - zipCode: "44691", - }, - distance: 64.8003821425259, - providerNumber: "006054", - }, - { - address: { - city: "NEW PHILADELPHIA", - country: "US", - state: "OH", - streetAddress: "1309-A MONROE STREET NW", - zipCode: "44663", - }, - distance: 76.4982256572348, - providerNumber: "005711", - }, - { - address: { - city: "FINDLAY", - country: "US", - state: "OH", - streetAddress: "1970 TIFFIN AVE", - zipCode: "45840", - }, - distance: 79.1332342134231, - providerNumber: "006141", - }, - { - address: { - city: "DAYTON", - country: "US", - state: "OH", - streetAddress: "8333 YANKEE ST", - zipCode: "45458", - }, - distance: 80.8164618523962, - providerNumber: "004104", - }, - { - address: { - city: "PARKERSBURG", - country: "US", - state: "WV", - streetAddress: "900 7TH ST", - zipCode: "26101", - }, - distance: 87.5874281799115, - providerNumber: "004134", - }, - { - address: { - city: "CANTON", - country: "US", - state: "OH", - streetAddress: "825 WERTZ AVE NW", - zipCode: "44708", - }, - distance: 88.4989369805638, - providerNumber: "005378", - }, - { - address: { - city: "HURON", - country: "US", - state: "OH", - streetAddress: "2401 SAWMILL PKWY", - zipCode: "44839", - }, - distance: 91.5072461453446, - providerNumber: "004461", - }, - { - address: { - city: "AKRON", - country: "US", - state: "OH", - streetAddress: "2567 S ARLINGTON RD", - zipCode: "44319", - }, - distance: 93.3296267574581, - providerNumber: "006242", - }, - { - address: { - city: "BRUNSWICK", - country: "US", - state: "OH", - streetAddress: "1402 PEARL RD", - zipCode: "44212", - }, - distance: 93.9890496539688, - providerNumber: "004083", - }, - { - address: { - city: "EATON", - country: "US", - state: "OH", - streetAddress: "MOBILE ONLY", - zipCode: "45320", - }, - distance: 99.1345313364146, - providerNumber: "005727", - }, ], }; @@ -303,7 +138,7 @@ const mockMixin = { }; describe("shop-question.vue", () => { - it.only("Should display first three shops when an appointment type has already been selected", async () => { + it("Should display first three shops when an appointment type has already been selected", async () => { // Arrange/Act const container = document.createElement("div"); container.scrollTo = jest.fn(); @@ -335,26 +170,26 @@ describe("shop-question.vue", () => { // Assert expect(wrapper.vm.answers.length).toEqual(3); - // expect(wrapper.vm.answers).toEqual([ - // { - // value: "123", - // buttonLabel: "Worthington", - // buttonLabelSubCopy: "1.5 mi", - // buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", - // }, - // { - // value: "124", - // buttonLabel: "Columbus", - // buttonLabelSubCopy: "4.5 mi", - // buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", - // }, - // { - // value: "125", - // buttonLabel: "Powell", - // buttonLabelSubCopy: "7 mi", - // buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223", - // }, - // ]); + expect(wrapper.vm.answers).toEqual([ + { + buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081", + buttonLabel: "4403 Executive Pkwy", + buttonLabelSubCopy: "5 mi", + value: "003335", + }, + { + buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", + buttonLabel: "760 Dearborn Park Ln", + buttonLabelSubCopy: "10.5 mi", + value: "001820", + }, + { + buttonBodyCopy: "5015 N High St, Columbus, OH 43214", + buttonLabel: "5015 N High St", + buttonLabelSubCopy: "11.5 mi", + value: "003343", + }, + ]); }); it("Should display the 'Show more locations' link when there are more than three locations to chose from", async () => { @@ -399,35 +234,43 @@ describe("shop-question.vue", () => { container.classList.add("page-container-grouped-styles"); document.body.appendChild(container); - const alsoShopQuestionInitialData = [ - { - city: "Worthington", - country: "United States", - distance: 1.5, - providerNumber: "123", - state: "OH", - streetAddress: "760 Dearborn Park Ln", - zipCode: "43085", - }, - { - city: "Columbus", - country: "United States", - distance: 4.5, - providerNumber: "124", - state: "OH", - streetAddress: "5486 N Hamilton Rd", - zipCode: "43230", - }, - { - city: "Powell", - country: "United States", - distance: 7, - providerNumber: "125", - state: "OH", - streetAddress: "1670 Harmon Ave C", - zipCode: "43223", - }, - ]; + const alsoShopQuestionInitialData = { + shopProviders: [ + { + address: { + city: "WESTERVILLE", + country: "US", + state: "OH", + streetAddress: "4403 EXECUTIVE PKWY", + zipCode: "43081", + }, + distance: 5.16769294095201, + providerNumber: "003335", + }, + { + address: { + city: "WORTHINGTON", + country: "US", + state: "OH", + streetAddress: "760 DEARBORN PARK LN", + zipCode: "43085", + }, + distance: 10.5865432478478, + providerNumber: "001820", + }, + { + address: { + city: "COLUMBUS", + country: "US", + state: "OH", + streetAddress: "5015 N HIGH ST", + zipCode: "43214", + }, + distance: 11.738869544543, + providerNumber: "003343", + }, + ], + }; const { wrapper } = setupMocks({ mixins: [mockMixin], @@ -455,7 +298,7 @@ describe("shop-question.vue", () => { expect(showMoreShopsLink.exists()).toBe(false); }); - it("Should display the next three shops when the 'Show more location' link is clicked", async () => { + it.only("Should display the next three shops when the 'Show more location' link is clicked", async () => { const container = document.createElement("div"); container.scrollTo = jest.fn(); @@ -464,22 +307,22 @@ describe("shop-question.vue", () => { const displayedAnswers = [ { - value: "123", - buttonLabel: "Worthington", - buttonLabelSubCopy: "1.5 mi", + buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081", + buttonLabel: "4403 Executive Pkwy", + buttonLabelSubCopy: "5 mi", + value: "003335", + }, + { buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", + buttonLabel: "760 Dearborn Park Ln", + buttonLabelSubCopy: "10.5 mi", + value: "001820", }, { - value: "124", - buttonLabel: "Columbus", - buttonLabelSubCopy: "4.5 mi", - buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", - }, - { - value: "125", - buttonLabel: "Powell", - buttonLabelSubCopy: "7 mi", - buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223", + buttonBodyCopy: "5015 N High St, Columbus, OH 43214", + buttonLabel: "5015 N High St", + buttonLabelSubCopy: "11.5 mi", + value: "003343", }, ]; @@ -498,8 +341,8 @@ describe("shop-question.vue", () => { }); wrapper.vm.$refs.buttonQuestion.resetField = jest.fn(); + wrapper.vm.initializeComponent(shopQuestionInitialData); - wrapper.vm.shops = shopQuestionInitialData; wrapper.vm.answers = displayedAnswers; wrapper.vm.shopIndex = 3; @@ -517,40 +360,40 @@ describe("shop-question.vue", () => { expect(wrapper.vm.answers.length).toBe(6); expect(wrapper.vm.answers).toEqual([ { - value: "123", - buttonLabel: "Worthington", - buttonLabelSubCopy: "1.5 mi", + buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081", + buttonLabel: "4403 Executive Pkwy", + buttonLabelSubCopy: "5 mi", + value: "003335", + }, + { buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", + buttonLabel: "760 Dearborn Park Ln", + buttonLabelSubCopy: "10.5 mi", + value: "001820", }, { - value: "124", - buttonLabel: "Columbus", - buttonLabelSubCopy: "4.5 mi", - buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", + buttonBodyCopy: "5015 N High St, Columbus, OH 43214", + buttonLabel: "5015 N High St", + buttonLabelSubCopy: "11.5 mi", + value: "003343", }, { - value: "125", - buttonLabel: "Powell", - buttonLabelSubCopy: "7 mi", - buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223", + buttonBodyCopy: "5015 N High St, Columbus, OH 43214", + buttonLabel: "5015 N High St", + buttonLabelSubCopy: "11.5 mi", + value: "003343", }, { - value: "126", - buttonLabel: "Chillicothe", - buttonLabelSubCopy: "41.5 mi", - buttonBodyCopy: "555 First Capital Ln, Chillicothe, OH 45601", + buttonBodyCopy: "1670 Harmon Ave, Columbus, OH 43223", + buttonLabel: "1670 Harmon Ave", + buttonLabelSubCopy: "16 mi", + value: "006747", }, { - value: "127", - buttonLabel: "Grove City", - buttonLabelSubCopy: "4.5 mi", - buttonBodyCopy: "5486 N Grove Rd, Grove City, OH 43215", - }, - { - value: "128", - buttonLabel: "Dayton", - buttonLabelSubCopy: "80.5 mi", - buttonBodyCopy: "1670 Bongo Ave D, Dayton, OH 43223", + buttonBodyCopy: "3938 Powell Rd, Powell, OH 43065", + buttonLabel: "3938 Powell Rd", + buttonLabelSubCopy: "16.5 mi", + value: "003341", }, ]); }); diff --git a/src/layouts/service-location/shop-question/shop-question.vue b/src/layouts/service-location/shop-question/shop-question.vue index 07d67b169..c3aa89fec 100644 --- a/src/layouts/service-location/shop-question/shop-question.vue +++ b/src/layouts/service-location/shop-question/shop-question.vue @@ -57,7 +57,7 @@ export default { mixins: [baseMixin], data() { return { - shops: [], + shopProviders: [], shopListButton: shopListButton, answers: [], shopIndex: 0, @@ -99,7 +99,6 @@ export default { }, initializeComponent(shopQuestionInitialData) { this.shopProviders = shopQuestionInitialData.shopProviders; - this.getNextShopsFromList(); }, async getNextShopsFromList(numberToGet = 3) { const shopIterator = (array, n) => {