lots of fixes, changes, styling, fixing outbound calls, rnode-flasher.
Some checks failed
CI / test-backend (push) Successful in 4s
CI / build-frontend (push) Successful in 1m49s
CI / test-lang (push) Successful in 1m47s
CI / test-backend (pull_request) Successful in 24s
Build and Publish Docker Image / build (pull_request) Has been skipped
CI / test-lang (pull_request) Successful in 52s
OSV-Scanner PR Scan / scan-pr (pull_request) Successful in 24s
CI / lint (push) Failing after 5m14s
CI / lint (pull_request) Failing after 5m8s
Tests / test (push) Failing after 9m17s
CI / build-frontend (pull_request) Successful in 9m48s
Benchmarks / benchmark (push) Successful in 14m52s
Benchmarks / benchmark (pull_request) Successful in 15m9s
Build and Publish Docker Image / build-dev (pull_request) Successful in 13m47s
Tests / test (pull_request) Failing after 25m50s
Build Test / Build and Test (pull_request) Successful in 53m37s
Build Test / Build and Test (push) Successful in 56m30s
Some checks failed
CI / test-backend (push) Successful in 4s
CI / build-frontend (push) Successful in 1m49s
CI / test-lang (push) Successful in 1m47s
CI / test-backend (pull_request) Successful in 24s
Build and Publish Docker Image / build (pull_request) Has been skipped
CI / test-lang (pull_request) Successful in 52s
OSV-Scanner PR Scan / scan-pr (pull_request) Successful in 24s
CI / lint (push) Failing after 5m14s
CI / lint (pull_request) Failing after 5m8s
Tests / test (push) Failing after 9m17s
CI / build-frontend (pull_request) Successful in 9m48s
Benchmarks / benchmark (push) Successful in 14m52s
Benchmarks / benchmark (pull_request) Successful in 15m9s
Build and Publish Docker Image / build-dev (pull_request) Successful in 13m47s
Tests / test (pull_request) Failing after 25m50s
Build Test / Build and Test (pull_request) Successful in 53m37s
Build Test / Build and Test (push) Successful in 56m30s
This commit is contained in:
@@ -4,29 +4,42 @@ import Toast from "@/components/Toast.vue";
|
||||
import GlobalEmitter from "@/js/GlobalEmitter";
|
||||
|
||||
describe("Toast.vue", () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
wrapper = mount(Toast, {
|
||||
global: {
|
||||
stubs: {
|
||||
TransitionGroup: { template: "<div><slot /></div>" },
|
||||
MaterialDesignIcon: {
|
||||
name: "MaterialDesignIcon",
|
||||
template: '<div class="mdi-stub"></div>',
|
||||
props: ["iconName"],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
if (wrapper) {
|
||||
wrapper.unmount();
|
||||
}
|
||||
vi.useRealTimers();
|
||||
// Clear all listeners from GlobalEmitter to avoid test pollution
|
||||
GlobalEmitter.off("toast");
|
||||
});
|
||||
|
||||
it("adds a toast when GlobalEmitter emits 'toast'", async () => {
|
||||
const wrapper = mount(Toast);
|
||||
|
||||
GlobalEmitter.emit("toast", { message: "Test Message", type: "success" });
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(wrapper.text()).toContain("Test Message");
|
||||
expect(wrapper.findComponent({ name: "MaterialDesignIcon" }).props("iconName")).toBe("check-circle");
|
||||
const icon = wrapper.findComponent({ name: "MaterialDesignIcon" });
|
||||
expect(icon.exists()).toBe(true);
|
||||
expect(icon.props("iconName")).toBe("check-circle");
|
||||
});
|
||||
|
||||
it("removes a toast after duration", async () => {
|
||||
const wrapper = mount(Toast);
|
||||
|
||||
GlobalEmitter.emit("toast", { message: "Test Message", duration: 1000 });
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
@@ -39,8 +52,6 @@ describe("Toast.vue", () => {
|
||||
});
|
||||
|
||||
it("removes a toast when clicking the close button", async () => {
|
||||
const wrapper = mount(Toast);
|
||||
|
||||
GlobalEmitter.emit("toast", { message: "Test Message", duration: 0 });
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
@@ -48,13 +59,12 @@ describe("Toast.vue", () => {
|
||||
|
||||
const closeButton = wrapper.find("button");
|
||||
await closeButton.trigger("click");
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
expect(wrapper.text()).not.toContain("Test Message");
|
||||
});
|
||||
|
||||
it("assigns correct classes for different toast types", async () => {
|
||||
const wrapper = mount(Toast);
|
||||
|
||||
GlobalEmitter.emit("toast", { message: "Success", type: "success" });
|
||||
GlobalEmitter.emit("toast", { message: "Error", type: "error" });
|
||||
await wrapper.vm.$nextTick();
|
||||
|
||||
Reference in New Issue
Block a user