🧪 ci: Update PermissionService tests for PromptGroup resource type

- Refactor tests to use PromptGroup roles instead of Project roles.
- Initialize models and seed default roles in test setup.
- Update error handling for non-existent resource types.
- Ensure proper cleanup of test data while retaining seeded roles.
This commit is contained in:
Danny Avila 2025-08-02 15:23:58 -04:00
parent fc8fd489d6
commit 90b037a67f
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
5 changed files with 66 additions and 99 deletions

View file

@ -96,16 +96,13 @@ jest.mock('~/hooks/useLocalize', () => ({
jest.mock('~/hooks', () => ({
useLocalize: () => mockLocalize,
useDebounce: jest.fn(),
useAgentCategories: jest.fn(),
}));
jest.mock('~/data-provider/Agents', () => ({
useMarketplaceAgentsInfiniteQuery: jest.fn(),
}));
jest.mock('~/hooks/Agents', () => ({
useAgentCategories: jest.fn(),
}));
// Mock utility functions
jest.mock('~/utils/agents', () => ({
renderAgentAvatar: jest.fn(() => <div data-testid="agent-avatar" />),
@ -120,8 +117,7 @@ jest.mock('../SmartLoader', () => ({
// Import the actual modules to get the mocked functions
import { useMarketplaceAgentsInfiniteQuery } from '~/data-provider/Agents';
import { useAgentCategories } from '~/hooks/Agents';
import { useDebounce } from '~/hooks';
import { useAgentCategories, useDebounce } from '~/hooks';
// Get typed mock functions
const mockUseMarketplaceAgentsInfiniteQuery = jest.mocked(useMarketplaceAgentsInfiniteQuery);