This commit is contained in:
Leah Schumann 2023-05-04 07:54:37 -04:00
parent c94bff0b55
commit 964f95c97f
2 changed files with 99 additions and 257 deletions

View file

@ -122,171 +122,6 @@ const shopQuestionInitialData = {
distance: 19.4618116611001, distance: 19.4618116611001,
providerNumber: "003342", 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", () => { 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 // Arrange/Act
const container = document.createElement("div"); const container = document.createElement("div");
container.scrollTo = jest.fn(); container.scrollTo = jest.fn();
@ -335,26 +170,26 @@ describe("shop-question.vue", () => {
// Assert // Assert
expect(wrapper.vm.answers.length).toEqual(3); expect(wrapper.vm.answers.length).toEqual(3);
// expect(wrapper.vm.answers).toEqual([ expect(wrapper.vm.answers).toEqual([
// { {
// value: "123", buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081",
// buttonLabel: "Worthington", buttonLabel: "4403 Executive Pkwy",
// buttonLabelSubCopy: "1.5 mi", buttonLabelSubCopy: "5 mi",
// buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", value: "003335",
// }, },
// { {
// value: "124", buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085",
// buttonLabel: "Columbus", buttonLabel: "760 Dearborn Park Ln",
// buttonLabelSubCopy: "4.5 mi", buttonLabelSubCopy: "10.5 mi",
// buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", value: "001820",
// }, },
// { {
// value: "125", buttonBodyCopy: "5015 N High St, Columbus, OH 43214",
// buttonLabel: "Powell", buttonLabel: "5015 N High St",
// buttonLabelSubCopy: "7 mi", buttonLabelSubCopy: "11.5 mi",
// buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223", value: "003343",
// }, },
// ]); ]);
}); });
it("Should display the 'Show more locations' link when there are more than three locations to chose from", async () => { 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"); container.classList.add("page-container-grouped-styles");
document.body.appendChild(container); document.body.appendChild(container);
const alsoShopQuestionInitialData = [ const alsoShopQuestionInitialData = {
{ shopProviders: [
city: "Worthington", {
country: "United States", address: {
distance: 1.5, city: "WESTERVILLE",
providerNumber: "123", country: "US",
state: "OH", state: "OH",
streetAddress: "760 Dearborn Park Ln", streetAddress: "4403 EXECUTIVE PKWY",
zipCode: "43085", zipCode: "43081",
}, },
{ distance: 5.16769294095201,
city: "Columbus", providerNumber: "003335",
country: "United States", },
distance: 4.5, {
providerNumber: "124", address: {
state: "OH", city: "WORTHINGTON",
streetAddress: "5486 N Hamilton Rd", country: "US",
zipCode: "43230", state: "OH",
}, streetAddress: "760 DEARBORN PARK LN",
{ zipCode: "43085",
city: "Powell", },
country: "United States", distance: 10.5865432478478,
distance: 7, providerNumber: "001820",
providerNumber: "125", },
state: "OH", {
streetAddress: "1670 Harmon Ave C", address: {
zipCode: "43223", city: "COLUMBUS",
}, country: "US",
]; state: "OH",
streetAddress: "5015 N HIGH ST",
zipCode: "43214",
},
distance: 11.738869544543,
providerNumber: "003343",
},
],
};
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
mixins: [mockMixin], mixins: [mockMixin],
@ -455,7 +298,7 @@ describe("shop-question.vue", () => {
expect(showMoreShopsLink.exists()).toBe(false); 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"); const container = document.createElement("div");
container.scrollTo = jest.fn(); container.scrollTo = jest.fn();
@ -464,22 +307,22 @@ describe("shop-question.vue", () => {
const displayedAnswers = [ const displayedAnswers = [
{ {
value: "123", buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081",
buttonLabel: "Worthington", buttonLabel: "4403 Executive Pkwy",
buttonLabelSubCopy: "1.5 mi", buttonLabelSubCopy: "5 mi",
value: "003335",
},
{
buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085",
buttonLabel: "760 Dearborn Park Ln",
buttonLabelSubCopy: "10.5 mi",
value: "001820",
}, },
{ {
value: "124", buttonBodyCopy: "5015 N High St, Columbus, OH 43214",
buttonLabel: "Columbus", buttonLabel: "5015 N High St",
buttonLabelSubCopy: "4.5 mi", buttonLabelSubCopy: "11.5 mi",
buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", value: "003343",
},
{
value: "125",
buttonLabel: "Powell",
buttonLabelSubCopy: "7 mi",
buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223",
}, },
]; ];
@ -498,8 +341,8 @@ describe("shop-question.vue", () => {
}); });
wrapper.vm.$refs.buttonQuestion.resetField = jest.fn(); wrapper.vm.$refs.buttonQuestion.resetField = jest.fn();
wrapper.vm.initializeComponent(shopQuestionInitialData);
wrapper.vm.shops = shopQuestionInitialData;
wrapper.vm.answers = displayedAnswers; wrapper.vm.answers = displayedAnswers;
wrapper.vm.shopIndex = 3; wrapper.vm.shopIndex = 3;
@ -517,40 +360,40 @@ describe("shop-question.vue", () => {
expect(wrapper.vm.answers.length).toBe(6); expect(wrapper.vm.answers.length).toBe(6);
expect(wrapper.vm.answers).toEqual([ expect(wrapper.vm.answers).toEqual([
{ {
value: "123", buttonBodyCopy: "4403 Executive Pkwy, Westerville, OH 43081",
buttonLabel: "Worthington", buttonLabel: "4403 Executive Pkwy",
buttonLabelSubCopy: "1.5 mi", buttonLabelSubCopy: "5 mi",
value: "003335",
},
{
buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085", buttonBodyCopy: "760 Dearborn Park Ln, Worthington, OH 43085",
buttonLabel: "760 Dearborn Park Ln",
buttonLabelSubCopy: "10.5 mi",
value: "001820",
}, },
{ {
value: "124", buttonBodyCopy: "5015 N High St, Columbus, OH 43214",
buttonLabel: "Columbus", buttonLabel: "5015 N High St",
buttonLabelSubCopy: "4.5 mi", buttonLabelSubCopy: "11.5 mi",
buttonBodyCopy: "5486 N Hamilton Rd, Columbus, OH 43230", value: "003343",
}, },
{ {
value: "125", buttonBodyCopy: "5015 N High St, Columbus, OH 43214",
buttonLabel: "Powell", buttonLabel: "5015 N High St",
buttonLabelSubCopy: "7 mi", buttonLabelSubCopy: "11.5 mi",
buttonBodyCopy: "1670 Harmon Ave C, Powell, OH 43223", value: "003343",
}, },
{ {
value: "126", buttonBodyCopy: "1670 Harmon Ave, Columbus, OH 43223",
buttonLabel: "Chillicothe", buttonLabel: "1670 Harmon Ave",
buttonLabelSubCopy: "41.5 mi", buttonLabelSubCopy: "16 mi",
buttonBodyCopy: "555 First Capital Ln, Chillicothe, OH 45601", value: "006747",
}, },
{ {
value: "127", buttonBodyCopy: "3938 Powell Rd, Powell, OH 43065",
buttonLabel: "Grove City", buttonLabel: "3938 Powell Rd",
buttonLabelSubCopy: "4.5 mi", buttonLabelSubCopy: "16.5 mi",
buttonBodyCopy: "5486 N Grove Rd, Grove City, OH 43215", value: "003341",
},
{
value: "128",
buttonLabel: "Dayton",
buttonLabelSubCopy: "80.5 mi",
buttonBodyCopy: "1670 Bongo Ave D, Dayton, OH 43223",
}, },
]); ]);
}); });

View file

@ -57,7 +57,7 @@ export default {
mixins: [baseMixin], mixins: [baseMixin],
data() { data() {
return { return {
shops: [], shopProviders: [],
shopListButton: shopListButton, shopListButton: shopListButton,
answers: [], answers: [],
shopIndex: 0, shopIndex: 0,
@ -99,7 +99,6 @@ export default {
}, },
initializeComponent(shopQuestionInitialData) { initializeComponent(shopQuestionInitialData) {
this.shopProviders = shopQuestionInitialData.shopProviders; this.shopProviders = shopQuestionInitialData.shopProviders;
this.getNextShopsFromList();
}, },
async getNextShopsFromList(numberToGet = 3) { async getNextShopsFromList(numberToGet = 3) {
const shopIterator = (array, n) => { const shopIterator = (array, n) => {