本文整理汇总了TypeScript中fetch-mock.postOnce函数的典型用法代码示例。如果您正苦于以下问题:TypeScript postOnce函数的具体用法?TypeScript postOnce怎么用?TypeScript postOnce使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了postOnce函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should return results for remote recommend', () => {
fetchMock.postOnce('*', {fields: []});
expect.assertions(1);
return fetchCompassQLBuildSchema(data, {serverUrl: 'http://localhost'}).then(
result => {
return expect(result.fieldNames().length).toEqual(0);
}
);
});
示例2:
(fetchMock.calls("http://test.com")[0][1] as RequestInit).body;
const doneStatus: boolean = fetchMock.done();
const doneStatusArguments: boolean = fetchMock.done("http://test.com");
const calledStatus: boolean = fetchMock.called();
const calledStatusArguments = fetchMock.called("http://test.com");
(fetchMock.lastCall()[1] as RequestInit).body;
const lastUrl: string = fetchMock.lastUrl();
fetchMock.lastOptions();
fetchMock.get("http://test.com", 200);
fetchMock.getOnce("http://test.com", 200);
fetchMock.post("http://test.com", 200);
fetchMock.postOnce("http://test.com", 200);
fetchMock.put("http://test.com", 200);
fetchMock.putOnce("http://test.com", 200);
fetchMock.delete("http://test.com", 200);
fetchMock.deleteOnce("http://test.com", 200);
fetchMock.head("http://test.com", 200);
fetchMock.headOnce("http://test.com", 200);
fetchMock.patch("http://test.com", 200);
fetchMock.patchOnce("http://test.com", 200);
fetchMock.get("http://test.com", 200, {method: "GET"});
fetchMock.get("http://test.com", 200, {method: "GET", overwriteRoutes: true});
fetchMock.post("http://test.com", 200, {method: "POST"});
fetchMock.put("http://test.com", 200, {method: "PUT"});
fetchMock.delete("http://test.com", 200, {method: "DELETE"});
fetchMock.head("http://test.com", 200, {method: "HEAD"});