25 lines
731 B
TypeScript
25 lines
731 B
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
const apiClient = vi.hoisted(() => ({
|
|
get: vi.fn(),
|
|
}))
|
|
|
|
vi.mock('@/shared/api/client', () => ({ apiClient }))
|
|
|
|
import { fetchPlatformOverview } from './platformOps'
|
|
|
|
describe('platform ops API', () => {
|
|
it('loads the read-only platform overview', async () => {
|
|
const payload = {
|
|
generated_at: '2026-11-15T20:00:00+08:00',
|
|
totals: { tenant_count: 2 },
|
|
sites: [{ tenant_code: 'jieyou' }],
|
|
trend: [{ date: '2026-11-15' }],
|
|
}
|
|
apiClient.get.mockResolvedValueOnce({ data: { data: payload } })
|
|
|
|
await expect(fetchPlatformOverview()).resolves.toEqual(payload)
|
|
expect(apiClient.get).toHaveBeenCalledWith('/admin/platform/overview')
|
|
})
|
|
})
|