10 lines
714 B
TypeScript
10 lines
714 B
TypeScript
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<typeof import('@/shared/api/http')>(), 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')
|
|
})
|