Unit tests - first one completed
This commit is contained in:
parent
49347eb4be
commit
653918944e
1 changed files with 26 additions and 8 deletions
|
|
@ -87,13 +87,29 @@ afterEach(() => {
|
|||
});
|
||||
|
||||
describe("time-slot-modal-list-button-question.vue", () => {
|
||||
test.only("IsInsurance false should navigateWithSaving", async () => {
|
||||
test.only("When selected time slot is changed, a correctly formatted selectedTimeSlot should be emitted", async () => {
|
||||
//Arrange
|
||||
const date = "2023-07-01";
|
||||
const timeSlotId = "testRouteCodeId";
|
||||
const startTime = "8:00 AM";
|
||||
const endTime = "8:30 AM";
|
||||
const jobMaxMinutes = 100;
|
||||
const { wrapper } = setupMocks({
|
||||
customMountOptions: {
|
||||
router: {
|
||||
navigateWithSaving: jest.fn(),
|
||||
},
|
||||
propsData: {
|
||||
estimatedServiceMinutesMaximum: jobMaxMinutes,
|
||||
dateAndTimeSlotData: {
|
||||
date: date,
|
||||
timeSlots: [{
|
||||
id: timeSlotId,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
}]
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -111,11 +127,8 @@ describe("time-slot-modal-list-button-question.vue", () => {
|
|||
// openModal() { return null},
|
||||
// closeModal() {return null},
|
||||
// };
|
||||
wrapper.vm.dateAndTimeSlotData.timeSlots = [{
|
||||
|
||||
}];
|
||||
wrapper.vm.$refs.timeSlots.closeModal = jest.fn();
|
||||
wrapper.vm.selectedTimeSlotId = "testRouteCodeId";
|
||||
wrapper.vm.selectedTimeSlotId = timeSlotId;
|
||||
|
||||
//await nextTick();
|
||||
|
||||
|
|
@ -123,7 +136,13 @@ describe("time-slot-modal-list-button-question.vue", () => {
|
|||
|
||||
//Act
|
||||
//await wrapper.vm.forwardButtonAction();
|
||||
const expectedEmit =
|
||||
const expectedEmit = [[{
|
||||
date: date,
|
||||
routeCode: timeSlotId,
|
||||
startTime: startTime,
|
||||
endTime: endTime,
|
||||
jobMaxMinutes: jobMaxMinutes.toString(),
|
||||
}]];
|
||||
//Assert
|
||||
expect(wrapper.emitted()["update:modelValue"]).toEqual(expectedEmit);
|
||||
});
|
||||
|
|
@ -470,6 +489,7 @@ function setupMocks({ customMountOptions }) {
|
|||
const mountOptions = getMountOptions({
|
||||
...customMountOptions,
|
||||
});
|
||||
console.log(mountOptions);
|
||||
mountOptions.global.mocks["$store"] = store;
|
||||
mountOptions["attachTo"] = document.body;
|
||||
mountOptions.mixins = [{
|
||||
|
|
@ -479,8 +499,6 @@ function setupMocks({ customMountOptions }) {
|
|||
}];
|
||||
|
||||
|
||||
const questionText = "Question Text";
|
||||
|
||||
const wrapper = shallowMount(timeSlotModalQuestion, mountOptions);
|
||||
wrapper.vm.setCmsContent = jest.fn();
|
||||
return { wrapper };
|
||||
|
|
|
|||
Loading…
Reference in a new issue