|
|
|
@ -18,25 +18,25 @@ describe("Status.vue", () => {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
it("renders UP status correctly", () => {
|
|
|
|
|
const wrapper = mountStatus(1); // UP status
|
|
|
|
|
const wrapper = mountStatus(UP); // UP status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-primary");
|
|
|
|
|
expect(wrapper.text()).toBe("Up");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("renders DOWN status correctly", () => {
|
|
|
|
|
const wrapper = mountStatus(0); // DOWN status
|
|
|
|
|
const wrapper = mountStatus(DOWN); // DOWN status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-danger");
|
|
|
|
|
expect(wrapper.text()).toBe("Down");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("renders PENDING status correctly", () => {
|
|
|
|
|
const wrapper = mountStatus(2); // PENDING status
|
|
|
|
|
const wrapper = mountStatus(PENDING); // PENDING status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-warning");
|
|
|
|
|
expect(wrapper.text()).toBe("Pending");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("renders MAINTENANCE status correctly", () => {
|
|
|
|
|
const wrapper = mountStatus(3); // MAINTENANCE status
|
|
|
|
|
const wrapper = mountStatus(MAINTENANCE); // MAINTENANCE status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-maintenance");
|
|
|
|
|
expect(wrapper.text()).toBe("statusMaintenance");
|
|
|
|
|
});
|
|
|
|
@ -48,10 +48,46 @@ describe("Status.vue", () => {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("updates when status prop changes", async () => {
|
|
|
|
|
const wrapper = mountStatus(1); // UP status
|
|
|
|
|
const wrapper = mountStatus(UP); // UP status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-primary");
|
|
|
|
|
|
|
|
|
|
await wrapper.setProps({ status: 0 }); // Change to DOWN status
|
|
|
|
|
await wrapper.setProps({ status: DOWN }); // Change to DOWN status
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-danger");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("displays correct status classes", async () => {
|
|
|
|
|
// Test UP status
|
|
|
|
|
const wrapper = mountStatus(UP);
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-primary");
|
|
|
|
|
|
|
|
|
|
// Test DOWN status
|
|
|
|
|
await wrapper.setProps({ status: DOWN });
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-danger");
|
|
|
|
|
|
|
|
|
|
// Test PENDING status
|
|
|
|
|
await wrapper.setProps({ status: PENDING });
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-warning");
|
|
|
|
|
|
|
|
|
|
// Test MAINTENANCE status
|
|
|
|
|
await wrapper.setProps({ status: MAINTENANCE });
|
|
|
|
|
expect(wrapper.find(".badge").classes()).toContain("bg-maintenance");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("displays correct status text", async () => {
|
|
|
|
|
// Test UP status
|
|
|
|
|
const wrapper = mountStatus(UP);
|
|
|
|
|
expect(wrapper.text()).toBe("Up");
|
|
|
|
|
|
|
|
|
|
// Test DOWN status
|
|
|
|
|
await wrapper.setProps({ status: DOWN });
|
|
|
|
|
expect(wrapper.text()).toBe("Down");
|
|
|
|
|
|
|
|
|
|
// Test PENDING status
|
|
|
|
|
await wrapper.setProps({ status: PENDING });
|
|
|
|
|
expect(wrapper.text()).toBe("Pending");
|
|
|
|
|
|
|
|
|
|
// Test MAINTENANCE status
|
|
|
|
|
await wrapper.setProps({ status: MAINTENANCE });
|
|
|
|
|
expect(wrapper.text()).toBe("statusMaintenance");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|