mirror of
https://github.com/unraid/api.git
synced 2026-05-04 06:02:47 -05:00
0788756b91
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added ability to update existing API keys, including name, description, roles, and permissions, through the UI and GraphQL API. - Introduced a modal-based interface for creating and editing API keys with improved role and permission selection. - Added a new API Key Manager page and custom element for centralized API key management. - Enhanced API key listing with detailed views, role badges, permission counters, and copy-to-clipboard functionality. - Introduced reusable dialog components for consistent modal experiences. - Added plugin management capabilities with mutations to add or remove plugins. - Added comprehensive support for managing remote access, network URLs, and API key updates within the GraphQL schema. - **Bug Fixes** - Improved error handling and display for API key creation and update operations. - **Refactor** - Centralized API key modal and editing state management using a dedicated store. - Updated GraphQL queries and mutations to use reusable fragments for API key data. - Removed deprecated or redundant remote access and allowed origins configuration components and queries. - Simplified and updated input types for connect settings and remote access. - **Tests** - Added comprehensive tests for API key update logic and improved coverage for API key loading. - **Chores** - Updated configuration files and cleaned up unused schema and component files. - Added new dialog components and centralized exports for dialogs. - Improved ESLint configuration and import statements for better type handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
60 lines
1.3 KiB
TypeScript
60 lines
1.3 KiB
TypeScript
/**
|
|
* Modal store test coverage
|
|
*/
|
|
|
|
import { createPinia, setActivePinia } from 'pinia';
|
|
import { ref } from 'vue';
|
|
|
|
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);
|
|
});
|
|
});
|
|
});
|