Files
Sudo-Ivan 00b4290735
All checks were successful
CI / test-backend (push) Successful in 15s
CI / lint (push) Successful in 42s
CI / build-frontend (push) Successful in 9m35s
feat(tests): add comprehensive test suite for backend functionality, including database, configuration, and telemetry utilities
2026-01-02 19:41:05 -06:00

29 lines
994 B
JavaScript

import { mount } from "@vue/test-utils";
import { describe, it, expect } from "vitest";
import Toggle from "../../meshchatx/src/frontend/components/forms/Toggle.vue";
describe("Toggle.vue", () => {
it("renders label when provided", () => {
const wrapper = mount(Toggle, {
props: { id: "test-toggle", label: "Test Label" },
});
expect(wrapper.text()).toContain("Test Label");
});
it("emits update:modelValue on change", async () => {
const wrapper = mount(Toggle, {
props: { id: "test-toggle", modelValue: false },
});
const input = wrapper.find("input");
await input.setChecked(true);
expect(wrapper.emitted("update:modelValue")[0]).toEqual([true]);
});
it("reflects modelValue prop", () => {
const wrapper = mount(Toggle, {
props: { id: "test-toggle", modelValue: true },
});
expect(wrapper.find("input").element.checked).toBe(true);
});
});