Files
api/web/__test__/store/modal.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

62 lines
1.4 KiB
TypeScript

/**
* Modal store test coverage
*/
import { ref } from 'vue';
import { createPinia, setActivePinia } from 'pinia';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { useModalStore } from '~/store/modal';
vi.mock('@vueuse/core', () => ({
useToggle: (initial: boolean) => {
const state = ref(initial);
const toggle = () => {
state.value = !state.value;
};
return [state, toggle];
},
}));
describe('Modal Store', () => {
let store: ReturnType<typeof useModalStore>;
beforeEach(() => {
setActivePinia(createPinia());
store = useModalStore();
vi.clearAllMocks();
});
describe('State and Initialization', () => {
it('should initialize with modal visible', () => {
expect(store.modalVisible).toBe(true);
});
});
describe('Actions', () => {
it('should hide modal', () => {
store.modalHide();
expect(store.modalVisible).toBe(false);
});
it('should show modal', () => {
store.modalHide();
expect(store.modalVisible).toBe(false);
store.modalShow();
expect(store.modalVisible).toBe(true);
});
it('should toggle modal visibility', () => {
expect(store.modalVisible).toBe(true);
store.modalToggle();
expect(store.modalVisible).toBe(false);
store.modalToggle();
expect(store.modalVisible).toBe(true);
});
});
});