import { expect, it, vi } from 'vitest' import { http } from '@/shared/api/http' import { getOverseasLocation } from './locations' vi.mock('@/shared/api/http', async original => ({ ...await original(), http: { get: vi.fn() } })) it('reads one location through its warehouse-scoped detail endpoint without scanning pages', async () => { vi.mocked(http.get).mockResolvedValue({ code: '200', data: { id: '40', warehouseId: '92', locationCode: 'LOC' } }) expect(await getOverseasLocation('92', '40')).toEqual({ id: '40', warehouseId: '92', locationCode: 'LOC' }) expect(http.get).toHaveBeenCalledExactlyOnceWith('/platform/v1/overseas-warehouse-resources/92/locations/40') })