This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from KennethTrecy/web_template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
unit(consultation): move test to component
- Loading branch information
Showing
3 changed files
with
68 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import convertTimeToMinutes from "$/time/convert_time_to_minutes" | ||
import { shallowMount } from "@vue/test-utils" | ||
|
||
import Component from "./scheduler.vue" | ||
|
||
describe.skip("Component: consultation/helpers/scheduler", () => { | ||
it("can select within employee's schedules", async() => { | ||
const schedules = { | ||
"data": [ | ||
{ | ||
"attributes": { | ||
"dayName": "monday", | ||
"scheduleEnd": convertTimeToMinutes("09:00"), | ||
"scheduleStart": convertTimeToMinutes("08:00") | ||
}, | ||
"id": "1", | ||
"type": "employee_schedule" | ||
} | ||
], | ||
"meta": { | ||
"count": 1 | ||
} | ||
} as any | ||
|
||
const wrapper = shallowMount(Component, { | ||
"global": { | ||
"stubs": { | ||
"SelectableOptionsField": false | ||
} | ||
}, | ||
"props": { | ||
"chosenDay": "", | ||
"chosenTime": "", | ||
"consultantSchedules": schedules | ||
} | ||
}) | ||
|
||
// Load selectable days and its options | ||
const currentHour = 8 | ||
const castedWrapper = wrapper.vm as any | ||
castedWrapper.dateToday = new Date() | ||
castedWrapper.dateToday.setHours(currentHour) | ||
console.log(castedWrapper.dateToday) | ||
const selectableDay = wrapper.find(".selectable-day") | ||
expect(selectableDay.exists()).toBeTruthy() | ||
const dayOptions = selectableDay.findAll("option") | ||
expect(dayOptions).toHaveLength(3) | ||
|
||
// Load selectable times and its options | ||
const chosenDay = dayOptions[1].attributes("value") | ||
const selectableDayField = selectableDay.find("select") | ||
console.log(selectableDayField.html(), "\n\n\n") | ||
await selectableDayField.setValue(chosenDay) | ||
await wrapper.setProps({ chosenDay }) | ||
console.log(wrapper.html(), "\n\n\n") | ||
const selectableTime = wrapper.find(".selectable-time") | ||
expect(selectableTime.exists()).toBeTruthy() | ||
// const timeOptions = selectableTime.findAll("option") | ||
// expect(selectableTime.exists()).toBeTruthy() | ||
// expect(timeOptions.length).toBeGreaterThan(0) | ||
|
||
// Customizable date | ||
// await selectableDayField.setValue(dayOptions[2].attributes("value")) | ||
// expect(selectableTime.exists()).toBeTruthy() | ||
// expect(timeOptions.length).toBeGreaterThan(0) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters