ai insight rework #2
This commit is contained in:
1 parent
9d76f54d33
commit
e1987d6999
39 files changed
+2311
-830
No files matched your search
@@ -2,39 +2,45 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import SettingsPage from '../SettingsPage.tsx';
|
||||
|
||||
const { createKandangMock, createFlockMock, updateFlockMock, createCycleMock, updateCycleMock, reloadMock, farmState } = vi.hoisted(
|
||||
() => ({
|
||||
createKandangMock: vi.fn(),
|
||||
createFlockMock: vi.fn(),
|
||||
updateFlockMock: vi.fn(),
|
||||
createCycleMock: vi.fn(),
|
||||
updateCycleMock: vi.fn(),
|
||||
reloadMock: vi.fn().mockResolvedValue(undefined),
|
||||
farmState: {
|
||||
sites: [{ id: 'site-a', site_name: 'Site A', user: 99, created_at: '', updated_at: '' }],
|
||||
kandangs: [] as Array<{
|
||||
id: number;
|
||||
kandang_name: string;
|
||||
site: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}>,
|
||||
flocks: [] as Array<{
|
||||
id: number;
|
||||
flock_name: string;
|
||||
iot_api_url?: string;
|
||||
kandang: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}>,
|
||||
cycles: [] as unknown[],
|
||||
selectedSiteId: 'site-a',
|
||||
selectedKandangId: null as number | null,
|
||||
selectedCycleId: null as number | null,
|
||||
selectedCycle: null as unknown,
|
||||
},
|
||||
})
|
||||
);
|
||||
const {
|
||||
createKandangMock,
|
||||
createFlockMock,
|
||||
updateFlockMock,
|
||||
createCycleMock,
|
||||
updateCycleMock,
|
||||
reloadMock,
|
||||
farmState,
|
||||
} = vi.hoisted(() => ({
|
||||
createKandangMock: vi.fn(),
|
||||
createFlockMock: vi.fn(),
|
||||
updateFlockMock: vi.fn(),
|
||||
createCycleMock: vi.fn(),
|
||||
updateCycleMock: vi.fn(),
|
||||
reloadMock: vi.fn().mockResolvedValue(undefined),
|
||||
farmState: {
|
||||
sites: [{ id: 'site-a', site_name: 'Site A', user: 99, created_at: '', updated_at: '' }],
|
||||
kandangs: [] as Array<{
|
||||
id: number;
|
||||
kandang_name: string;
|
||||
site: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}>,
|
||||
flocks: [] as Array<{
|
||||
id: number;
|
||||
flock_name: string;
|
||||
iot_api_url?: string;
|
||||
kandang: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}>,
|
||||
cycles: [] as unknown[],
|
||||
selectedSiteId: 'site-a',
|
||||
selectedKandangId: null as number | null,
|
||||
selectedCycleId: null as number | null,
|
||||
selectedCycle: null as unknown,
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock('../../services/apiClient.ts', () => ({
|
||||
api: {
|
||||
|
||||
Reference in new issue
Block a user