dify/web/service/try-app.spec.ts
Stephen Zhou ca8b680322
refactor(web): migrate trial app console contracts (#38254)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-01 16:31:49 +00:00

34 lines
769 B
TypeScript

import { consoleClient } from '@/service/client'
import { fetchTryAppDatasets } from './try-app'
vi.mock('@/service/client', () => ({
consoleClient: {
trialApps: {
byAppId: {
datasets: {
get: vi.fn(),
},
},
},
},
}))
describe('fetchTryAppDatasets', () => {
it('passes ids to the generated client', async () => {
vi.mocked(consoleClient.trialApps.byAppId.datasets.get).mockResolvedValue({
data: [],
has_more: false,
limit: 20,
page: 1,
total: 0,
})
await fetchTryAppDatasets('app-1', ['id-1', 'id-2'])
expect(consoleClient.trialApps.byAppId.datasets.get).toHaveBeenCalledWith({
params: { app_id: 'app-1' },
query: { ids: ['id-1', 'id-2'] },
})
})
})