Prettified and fixed unit tests
This commit is contained in:
parent
72315f779e
commit
27d44aae7a
2 changed files with 11 additions and 18 deletions
|
|
@ -434,7 +434,7 @@ describe("shop-question.vue", () => {
|
|||
const { wrapper } = setupMocks({
|
||||
mixins: [mockMixin],
|
||||
props: {
|
||||
modelValue: selectedProvider.providerNumber,
|
||||
modelValue: selectedProvider,
|
||||
serviceZipCode: "43081",
|
||||
selectedAppointmentType: "Dropoff",
|
||||
cmsWidgetName: cmsWidgetName,
|
||||
|
|
@ -460,18 +460,7 @@ describe("shop-question.vue", () => {
|
|||
const { wrapper } = setupMocks({
|
||||
mixins: [mockMixin],
|
||||
props: {
|
||||
modelValue: {
|
||||
address: {
|
||||
city: "POWELL",
|
||||
country: "US",
|
||||
state: "OH",
|
||||
streetAddress: "3938 POWELL RD",
|
||||
zipCode: "43065",
|
||||
},
|
||||
distanceInMiles: 16.2690495685233,
|
||||
providerNumber: "003341",
|
||||
},
|
||||
serviceZipCode: "43081",
|
||||
modelValue: null,
|
||||
selectedAppointmentType: "Dropoff",
|
||||
cmsWidgetName: cmsWidgetName,
|
||||
},
|
||||
|
|
@ -481,21 +470,24 @@ describe("shop-question.vue", () => {
|
|||
});
|
||||
|
||||
// Act
|
||||
wrapper.vm.initializeComponent(shopQuestionInitialData);
|
||||
await wrapper.vm.initializeComponent(shopQuestionInitialData);
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(wrapper.vm.answers.length).toEqual(3);
|
||||
|
||||
await wrapper.setProps({
|
||||
selectedAppointmentType: "Inshop",
|
||||
});
|
||||
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.answers.length).toEqual(3);
|
||||
});
|
||||
|
||||
// it("Should reload the shops when the service zip code changes", async () => {
|
||||
// it.only("Should reload the shops when the service zip code changes", async () => {
|
||||
// // Arrange
|
||||
// const { wrapper } = setupMocks({
|
||||
// mixins: [mockMixin],
|
||||
|
|
@ -514,7 +506,7 @@ describe("shop-question.vue", () => {
|
|||
// serviceZipCode: "43081",
|
||||
// selectedAppointmentType: "Dropoff",
|
||||
// cmsWidgetName: cmsWidgetName,
|
||||
// isDisplayed: true
|
||||
// isDisplayed: true,
|
||||
// },
|
||||
// mountOptions: {
|
||||
// attachTo: document.body,
|
||||
|
|
@ -530,7 +522,7 @@ describe("shop-question.vue", () => {
|
|||
// // Act
|
||||
// wrapper.vm.initializeComponent(shopQuestionInitialData);
|
||||
|
||||
// await wrapper.vm.$options.watch.serviceZipCode.handler.call(wrapper.vm, "43054");
|
||||
// //await wrapper.vm.$options.watch.serviceZipCode.handler.call(wrapper.vm, "43054");
|
||||
|
||||
// // Assert
|
||||
// expect(wrapper.vm.shopProviders.length).toEqual(3);
|
||||
|
|
|
|||
|
|
@ -216,13 +216,14 @@ export default {
|
|||
if (this.selectedAppointmentType) {
|
||||
const selectedShopIndex = this.getSelectedProviderIndex(
|
||||
newValue,
|
||||
this.modelValue.providerNumber
|
||||
this.modelValue?.providerNumber
|
||||
);
|
||||
|
||||
if (selectedShopIndex >= 3) {
|
||||
await this.getNextShopsFromList(selectedShopIndex + 1);
|
||||
} else {
|
||||
await this.getNextShopsFromList();
|
||||
await this.$nextTick();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue