本文整理匯總了TypeScript中jest-fetch-mock.mockResponse函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript mockResponse函數的具體用法?TypeScript mockResponse怎麽用?TypeScript mockResponse使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mockResponse函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it("returns error when LARA response is malformed", done => {
const runtimeContext = generateEmbeddableRuntimeContext(embeddableContext);
fetch.mockResponse("{malformedJSON:");
const resp = runtimeContext.getInteractiveState();
expect(fetch.mock.calls[0][0]).toEqual(embeddableContext.interactiveStateUrl);
expect(resp).toBeInstanceOf(Promise);
resp!.catch(err => {
done();
});
});
示例2: it
it("returns error when LARA response is malformed", done => {
const runtimeContext = generatePluginRuntimeContext(pluginContext);
fetch.mockResponse("{malformedJSON:");
const resp = runtimeContext.getClassInfo();
expect(fetch.mock.calls[0][0]).toEqual(pluginContext.classInfoUrl);
expect(resp).toBeInstanceOf(Promise);
resp!.catch(err => {
done();
});
});