Skip to content

Commit c70f863

Browse files
committed
Addition of unit tests for FirstStep.js
1 parent ff6d11b commit c70f863

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

tests/unit/FirstStep.spec.js

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { mount } from "@vue/test-utils";
2+
import FirstStep from "@/Components/FirstStep.vue";
3+
4+
describe("FirstStep.vue", () => {
5+
const wrapper = mount(FirstStep);
6+
it("Has the main div tag", () => {
7+
expect(wrapper.contains(".step-content")).toBe(true);
8+
});
9+
10+
it("renders without any errors", () => {
11+
expect(wrapper.isVueInstance()).toBeTruthy();
12+
});
13+
14+
it("Checks if the cardtext function return the correct answer when selected is true", () => {
15+
wrapper.setProps({
16+
selected: true
17+
});
18+
19+
expect(wrapper.vm.cardText).toBe("stepper.FS.selected");
20+
});
21+
22+
it("Checks if the cardtext function return the correct answer when selected is false", () => {
23+
wrapper.setProps({
24+
selected: false
25+
});
26+
27+
expect(wrapper.vm.cardText).toBe("stepper.FS.not-selected");
28+
});
29+
30+
it("Checks if the yesText function returns correct answer", () => {
31+
expect(wrapper.vm.yesText).toBe("stepper.FS.selected");
32+
});
33+
34+
it("Checks if the yesText function returns correct answer", () => {
35+
expect(wrapper.vm.noText).toBe("stepper.FS.not-selected");
36+
});
37+
38+
it("Checks if the yesSelected function returns the correct boolean when selected is true", () => {
39+
wrapper.setProps({
40+
selected: true
41+
});
42+
expect(wrapper.vm.yesSelected).toBe("selected");
43+
});
44+
45+
it("Checks if the yesSelected function returns the correct boolean when selected is false", () => {
46+
wrapper.setProps({
47+
selected: false
48+
});
49+
expect(wrapper.vm.yesSelected).toBe("not-selected");
50+
});
51+
52+
it("Checks if the get function in radio returns the correct value when selected is undefined", () => {
53+
wrapper.setProps({
54+
selected: undefined
55+
});
56+
expect(wrapper.vm.radio).toBe(undefined);
57+
});
58+
59+
it("Checks if the get function in radio returns the correct value when selected is yes", () => {
60+
wrapper.setData({
61+
selected: "yes"
62+
});
63+
expect(wrapper.vm.radio).toBe("yes");
64+
});
65+
66+
it("Checks if the noSelected function returns the correct boolean when selected is true", () => {
67+
wrapper.setProps({
68+
selected: true
69+
});
70+
expect(wrapper.vm.noSelected).toBe("not-selected");
71+
});
72+
73+
it("Checks if the noSelected function returns the correct boolean when selected is false", () => {
74+
wrapper.setProps({
75+
selected: false
76+
});
77+
expect(wrapper.vm.noSelected).toBe("selected");
78+
});
79+
});

0 commit comments

Comments
 (0)