feat(tests): add comprehensive test suite for backend functionality, including database, configuration, and telemetry utilities
This commit is contained in:
28
tests/frontend/Toggle.test.js
Normal file
28
tests/frontend/Toggle.test.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user