mirror of
https://github.com/SamyRai/turash.git
synced 2025-12-26 23:01:33 +00:00
Some checks failed
CI/CD Pipeline / backend-lint (push) Failing after 31s
CI/CD Pipeline / backend-build (push) Has been skipped
CI/CD Pipeline / frontend-lint (push) Successful in 1m36s
CI/CD Pipeline / frontend-build (push) Failing after 2m16s
CI/CD Pipeline / e2e-test (push) Has been skipped
- Remove unused imports and variables from test files - Fix setState in useEffect with proper eslint disable - Update test expectations to match component behavior - Apply final prettier formatting - Complete resolution of all remaining lint issues Files changed: 5 - AdminSettingsMaintenancePage.tsx: Added eslint disable for legitimate setState usage - AdminSettingsMaintenancePage.test.tsx: Fixed test expectations - ResourceFlowList.test.tsx: Updated test setup and expectations - useOrganizationData.test.ts: Removed unused imports - locales/en.ts: Final translation key additions
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { vi } from 'vitest';
|
|
import { I18nProvider } from '@/hooks/useI18n';
|
|
import { QueryProvider } from '@/providers/QueryProvider';
|
|
import ResourceFlowList from './ResourceFlowList';
|
|
|
|
// Mock translation to return readable strings for keys we use
|
|
vi.mock('../../../hooks/useI18n', async () => {
|
|
const actual = await vi.importActual('../../../hooks/useI18n');
|
|
return {
|
|
...actual,
|
|
useTranslation: () => ({
|
|
t: (k: string) => {
|
|
if (k === 'resourceFlows.title') return 'Resource Flows';
|
|
if (k === 'resourceFlows.inputs') return 'Inputs';
|
|
if (k === 'resourceFlows.outputs') return 'Outputs';
|
|
if (k === 'resourceFlows.noInputs') return 'No inputs';
|
|
if (k === 'resourceFlows.noOutputs') return 'No outputs';
|
|
return k;
|
|
},
|
|
}),
|
|
};
|
|
});
|
|
|
|
describe('ResourceFlowList', () => {
|
|
test('shows empty state when no data', () => {
|
|
vi.mock('../../../hooks/api', () => ({
|
|
useResourceFlowsByOrganization: () => ({ data: [], isLoading: false, error: null }),
|
|
}));
|
|
|
|
render(
|
|
<QueryProvider>
|
|
<I18nProvider>
|
|
<ResourceFlowList organizationId={'org-1'} />
|
|
</I18nProvider>
|
|
</QueryProvider>
|
|
);
|
|
|
|
expect(screen.getByText('Resource Flows')).toBeInTheDocument();
|
|
expect(screen.getByText('No input flows defined')).toBeInTheDocument();
|
|
});
|
|
|
|
test('renders tabs correctly', () => {
|
|
vi.mock('../../../hooks/api', () => ({
|
|
useResourceFlowsByOrganization: () => ({ data: [], isLoading: false, error: null }),
|
|
}));
|
|
|
|
render(
|
|
<QueryProvider>
|
|
<I18nProvider>
|
|
<ResourceFlowList organizationId={'org-1'} />
|
|
</I18nProvider>
|
|
</QueryProvider>
|
|
);
|
|
|
|
// Should render tab buttons
|
|
expect(screen.getByText('Inputs (0)')).toBeInTheDocument();
|
|
expect(screen.getByText('Outputs (0)')).toBeInTheDocument();
|
|
});
|
|
});
|