本文整理匯總了TypeScript中axios-mock-adapter.onPost函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript onPost函數的具體用法?TypeScript onPost怎麽用?TypeScript onPost使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了onPost函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('invalid response data', async () => {
mockAdapter.onPost(PRODUCTLINE_ENDPOINT).reply(200)
await store.dispatch(ProductLines.create({
bbox: [1, 2, 3, 4],
} as any) as any)
const actions = store.getActions()
expect(actions[0].type).toEqual(ProductLinesActions.CreatingProductLine.type)
expect(actions[1].type).toEqual(ProductLinesActions.CreateProductLineError.type)
expect(actions[1].payload).toHaveProperty('error')
})
示例2: test
test('invalid response data', async () => {
mockAdapter.onPost(JOB_ENDPOINT).reply(200)
await store.dispatch(Jobs.createJob({
algorithmId: 'algorithmId',
computeMask: true,
name: 'name',
catalogApiKey: 'catalogApiKey',
sceneId: 'sceneId',
}) as any)
const actions = store.getActions()
expect(actions.length).toEqual(2)
expect(actions[0]).toEqual({ type: JobsActions.CreatingJob.type })
expect(actions[1].type).toEqual(JobsActions.CreateJobError.type)
expect(actions[1].payload).toHaveProperty('error')
})