Files
api/web/__test__/components/DevSettings.test.ts
Eli Bosley af5ca11860 Feat/vue (#1655)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- New Features
- Introduced Docker management UI components: Overview, Logs, Console,
Preview, and Edit.
- Added responsive Card/Detail layouts with grouping, bulk actions, and
tabs.
  - New UnraidToaster component and global toaster configuration.
- Component auto-mounting improved with async loading and multi-selector
support.
- UI/UX
- Overhauled theme system (light/dark tokens, primary/orange accents)
and added theme variants.
  - Header OS version now includes integrated changelog modal.
- Registration displays warning states; multiple visual polish updates.
- API
  - CPU load now includes percentGuest and percentSteal metrics.
- Chores
  - Migrated web app to Vite; updated artifacts and manifests.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mdatelle <mike@datelle.net>
Co-authored-by: Michael Datelle <mdatelle@icloud.com>
2025-09-08 10:04:49 -04:00

52 lines
1.6 KiB
TypeScript

/**
* DevSettings Component Test Coverage
*/
import { nextTick } from 'vue';
import { mount } from '@vue/test-utils';
import { CogIcon } from '@heroicons/vue/24/solid';
import { Button, PopoverContent, PopoverTrigger } from '@unraid/ui';
import { describe, expect, it, vi } from 'vitest';
import DevSettings from '~/components/DevSettings.vue';
vi.mock('@unraid/ui', async (importOriginal) => {
const actual = (await importOriginal()) as Record<string, unknown>;
return {
...actual,
};
});
describe('DevSettings', () => {
it('renders the trigger button and hides content initially', () => {
const wrapper = mount(DevSettings, {
global: {
stubs: { DummyServerSwitcher: true },
},
});
const triggerButton = wrapper.findComponent(PopoverTrigger).findComponent(Button);
expect(triggerButton.exists()).toBe(true);
expect(triggerButton.findComponent(CogIcon).exists()).toBe(true);
expect(wrapper.findComponent(PopoverContent).exists()).toBe(true);
expect(wrapper.findComponent({ name: 'DummyServerSwitcher' }).exists()).toBe(false);
});
it('does not error when trigger button is clicked', async () => {
const wrapper = mount(DevSettings, {
global: {
stubs: { DummyServerSwitcher: true, PopoverContent: true },
},
});
const triggerButton = wrapper.findComponent(PopoverTrigger).findComponent(Button);
await triggerButton.trigger('click');
await new Promise((resolve) => setTimeout(resolve, 0));
await nextTick();
// No assertion needed here, the test passes if no error is thrown during the click simulation.
});
});