UNCLASSIFIED

Commit a5b26d38 authored by Keith Becker's avatar Keith Becker
Browse files

refactor unit tests

parent 0df11b33
...@@ -53,4 +53,24 @@ describe("UserSelectForCourse", () => { ...@@ -53,4 +53,24 @@ describe("UserSelectForCourse", () => {
const isFound = html.indexOf("123456789") !== -1; const isFound = html.indexOf("123456789") !== -1;
expect(isFound).toEqual(true); expect(isFound).toEqual(true);
}); });
it("test default values", async () => {
const wrapper = shallowMount(UserSelectForCourse, {
propsData: {
availableSeatsInCourse: 123456789,
areNoAvailableSeats: false,
courseStartDate: "test",
isCourseSelected: true,
value: [],
},
vuetify,
});
expect(wrapper.vm.selectedMembers).toEqual([]);
expect(wrapper.vm.updateCourseMembers.toString()).toEqual(
`() => {
/* istanbul ignore next */
cov_1vj0pbuf92.f[2]++;
}`
);
});
}); });
...@@ -160,4 +160,42 @@ describe("SelectAddStudentsToCourseDialog", () => { ...@@ -160,4 +160,42 @@ describe("SelectAddStudentsToCourseDialog", () => {
expect(wrapper.vm.$emit).toHaveBeenCalled(); expect(wrapper.vm.$emit).toHaveBeenCalled();
expect(wrapper.vm.$refs.courseSelect.clear).toHaveBeenCalled(); expect(wrapper.vm.$refs.courseSelect.clear).toHaveBeenCalled();
}); });
it("should emit event when canceled", async () => {
const wrapper = shallowMount(SelectAddStudentsToCourseDialog, {
propsData: {
value: [],
selectedMembers: [],
},
mocks: {
$store: {
commit: jest.fn(),
},
},
vuetify,
});
wrapper.vm.$emit = jest.fn();
wrapper.vm.clear = jest.fn();
wrapper.vm.cancel();
expect(wrapper.vm.$emit).toHaveBeenCalled();
expect(wrapper.vm.clear).toHaveBeenCalled();
});
it("should call function when clear", async () => {
const wrapper = shallowMount(SelectAddStudentsToCourseDialog, {
propsData: {
value: [],
selectedMembers: [],
},
mocks: {
$store: {
commit: jest.fn(),
},
},
vuetify,
});
wrapper.vm.$refs = { courseSelect: { clear: jest.fn() } };
wrapper.vm.courseStartDate = "test";
wrapper.vm.clear();
expect(wrapper.vm.$refs.courseSelect.clear).toHaveBeenCalled();
expect(wrapper.vm.courseStartDate).toEqual("");
});
}); });
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment