v0.1.12
This commit is contained in:
@@ -11,6 +11,7 @@ const apiMocks = vi.hoisted(() => ({
|
||||
productCosts: vi.fn(),
|
||||
scenarios: vi.fn(),
|
||||
dataQuality: vi.fn(),
|
||||
dashboardSummary: vi.fn(),
|
||||
clientAccess: vi.fn(),
|
||||
clientAccessExport: vi.fn()
|
||||
}));
|
||||
@@ -61,6 +62,13 @@ describe('route loaders use the SvelteKit fetch argument', () => {
|
||||
apiMocks.productCosts.mockResolvedValue([{ id: 4 }]);
|
||||
apiMocks.scenarios.mockResolvedValue([{ id: 5 }]);
|
||||
apiMocks.dataQuality.mockResolvedValue([{ id: 6 }]);
|
||||
apiMocks.dashboardSummary.mockResolvedValue({
|
||||
raw_materials: null,
|
||||
mixes: null,
|
||||
products: null,
|
||||
trend_seeds: { raw_material_cost_per_kg: [], mix_cost_per_kg: [], product_finished_delivered: [] },
|
||||
operations: null
|
||||
});
|
||||
apiMocks.clientAccess.mockResolvedValue([{ id: 7 }]);
|
||||
apiMocks.clientAccessExport.mockResolvedValue({
|
||||
generated_at: '',
|
||||
@@ -74,13 +82,10 @@ describe('route loaders use the SvelteKit fetch argument', () => {
|
||||
});
|
||||
|
||||
it('passes fetch through the home page loader', async () => {
|
||||
await homeLoad({ fetch: fetcher } as never);
|
||||
const result = homeLoad({ fetch: fetcher } as never);
|
||||
await result.summary;
|
||||
|
||||
expect(apiMocks.rawMaterials).toHaveBeenCalledWith(fetcher);
|
||||
expect(apiMocks.mixes).toHaveBeenCalledWith(fetcher);
|
||||
expect(apiMocks.productCosts).toHaveBeenCalledWith(fetcher);
|
||||
expect(apiMocks.scenarios).toHaveBeenCalledWith(fetcher);
|
||||
expect(apiMocks.dataQuality).toHaveBeenCalledWith(fetcher);
|
||||
expect(apiMocks.dashboardSummary).toHaveBeenCalledWith(fetcher);
|
||||
});
|
||||
|
||||
it('passes fetch through the raw materials loader', async () => {
|
||||
|
||||
Reference in New Issue
Block a user