mirror of
https://github.com/unraid/api.git
synced 2025-12-29 20:49:53 -06:00
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced comprehensive testing utilities for Vue components utilizing the composition API. - Enhanced testing coverage for the `DownloadApiLogs` and `KeyActions` components, ensuring robust functionality and user interaction validation. - Added mock implementations for various libraries and components to facilitate isolated unit testing. - Improved flexibility in the `DummyServerSwitcher` component's input handling. - Added a new test setup file to configure the testing environment for Vue applications. - Added new test files for `AuthComponent` and `KeyActions` with comprehensive test cases. - Introduced a new mock implementation for UI components to streamline testing. - Added a new mock implementation for the `useRequest` composable to prevent hanging issues during tests. - Added a new mock implementation for the server store used by the Auth component. - **Bug Fixes** - Improved sanitization process to block inline styles for a safer and more consistent display. - **Documentation** - Added README documentation for Vue Component Testing Utilities, detailing usage and examples. - Updated ESLint configuration to ignore coverage directory files. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: mdatelle <mike@datelle.net> Co-authored-by: Eli Bosley <ekbosley@gmail.com>
45 lines
923 B
TypeScript
45 lines
923 B
TypeScript
import { config } from '@vue/test-utils';
|
|
|
|
import { createTestingPinia } from '@pinia/testing';
|
|
import { afterAll, beforeAll, vi } from 'vitest';
|
|
|
|
// Import mocks
|
|
import './mocks/vue-i18n.ts';
|
|
import './mocks/vue.ts';
|
|
import './mocks/pinia.ts';
|
|
import './mocks/shared-callbacks.ts';
|
|
import './mocks/ui-libraries.ts';
|
|
import './mocks/ui-components.ts';
|
|
import './mocks/stores/index.ts';
|
|
import './mocks/services/index.ts';
|
|
|
|
// Configure Vue Test Utils
|
|
config.global.plugins = [
|
|
createTestingPinia({
|
|
createSpy: vi.fn,
|
|
}),
|
|
// Simple mock for i18n
|
|
{
|
|
install: vi.fn(),
|
|
},
|
|
];
|
|
|
|
// Set a timeout for tests
|
|
vi.setConfig({
|
|
testTimeout: 10000,
|
|
hookTimeout: 10000,
|
|
});
|
|
|
|
// Mock fetch
|
|
globalThis.fetch = vi.fn(() =>
|
|
Promise.resolve({
|
|
ok: true,
|
|
json: () => Promise.resolve({}),
|
|
text: () => Promise.resolve(''),
|
|
} as Response)
|
|
);
|
|
|
|
// Global setup and cleanup
|
|
beforeAll(() => {});
|
|
afterAll(() => {});
|