mirror of
https://github.com/unraid/api.git
synced 2026-01-06 00:30:22 -06:00
test: create tests for components batch 2 (#1365)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Improved component tests by integrating Pinia's testing utilities for more reliable store mocking and state management. - Updated test setup to streamline plugin usage and remove unnecessary configuration. - Enhanced test clarity by relying on store state changes and Vue's reactivity instead of manual mock updates. - Simplified test cases by focusing on passed props and standardized store mocking. - **Chores** - Updated test directory structure for better organization. - Added additional test mocks for dependencies. - **New Features** - Added comprehensive tests for the ColorSwitcher component, verifying UI elements and theme store interactions. - Introduced tests for the DevSettings component, confirming UI rendering and interaction behavior. - Added detailed tests for the DowngradeOs component covering store interactions and conditional UI rendering. - Added new test suites for DummyServerSwitcher component, ensuring correct rendering and reactive state updates. - Added new test suites for HeaderOsVersion component, validating version badge rendering and error state handling. - Added new test suite for the I18nHost component, validating internationalization context provisioning and error handling. - Added a comprehensive test suite for the Modal component, covering UI behavior, styling, and event handling. - Added new test suite for the Registration component, verifying rendering based on server state. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net>
This commit is contained in:
@@ -6,12 +6,14 @@
|
||||
// import QueryStringAddon from 'wretch/addons/queryString';
|
||||
|
||||
// import { OS_RELEASES } from '~/helpers/urls';
|
||||
import { computed, ref } from 'vue';
|
||||
import { defineStore } from 'pinia';
|
||||
|
||||
import type {
|
||||
Server,
|
||||
ServerState,
|
||||
// ServerUpdateOsResponse,
|
||||
} from '~/types/server';
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
// dayjs plugins
|
||||
// extend(customParseFormat);
|
||||
@@ -194,7 +196,7 @@ const baseServerState: Server = {
|
||||
};
|
||||
|
||||
export type ServerSelector = 'default' | 'oemActivation';
|
||||
const defaultServer: ServerSelector = 'default';
|
||||
export const defaultServer: ServerSelector = 'default';
|
||||
|
||||
const servers: Record<ServerSelector, Server> = {
|
||||
default: baseServerState,
|
||||
@@ -217,8 +219,8 @@ const servers: Record<ServerSelector, Server> = {
|
||||
},
|
||||
};
|
||||
|
||||
export const useDummyServerStore = defineStore('_dummyServer',() => {
|
||||
export const useDummyServerStore = defineStore('_dummyServer', () => {
|
||||
const selector = ref<ServerSelector>(defaultServer);
|
||||
const serverState = computed(() => servers[selector.value] ?? servers.default);
|
||||
return { selector, serverState };
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user