19 lines
969 B
TypeScript
19 lines
969 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import { MemoryRouter } from 'react-router-dom';
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
import api from '../services/api';
|
|
import CompanyOrchestrationHQ from './CompanyOrchestrationHQ';
|
|
|
|
vi.mock('../services/api', () => ({ default: { get: vi.fn() } }));
|
|
|
|
describe('governance source integrity', () => {
|
|
beforeEach(() => { vi.clearAllMocks(); });
|
|
it('shows unavailable instead of a synthetic active department when APIs fail', async () => {
|
|
vi.mocked(api.get).mockRejectedValue(new Error('offline'));
|
|
render(<MemoryRouter><CompanyOrchestrationHQ /></MemoryRouter>);
|
|
expect(await screen.findByText(/دادههای وضعیت در دسترس نیست/)).toBeInTheDocument();
|
|
expect(screen.queryByText(/سیستم زنده و فعال/)).not.toBeInTheDocument();
|
|
expect(screen.queryByText(/نمای سهبعدی و بصری/)).not.toBeInTheDocument();
|
|
});
|
|
});
|