當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript fetch-mock.calls函數代碼示例

本文整理匯總了TypeScript中src/util/fetch-mock.calls函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript calls函數的具體用法?TypeScript calls怎麽用?TypeScript calls使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了calls函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

 return p.then(() => {
   assert.lengthOf(fetchMock.calls(expectedURL), 1);
   assert.lengthOf(_.keys(state), 1);
   assert.equal(state[missingKey].data, undefined);
   assert.property(state[missingKey], "data");
   assert.equal(state[missingKey].status, uidata.UIDataStatus.VALID);
   assert.isNull(state[missingKey].error);
 });
開發者ID:a6802739,項目名稱:cockroach,代碼行數:8,代碼來源:uiData.spec.ts

示例2:

 return Promise.all([p1, p2]).then(() => {
   // Assert that the server got the correct number of requests (2).
   assert.lengthOf(fetchMock.calls("ts/query"), 3);
   // Assert that the mock metrics state has 5 queries.
   assert.lengthOf(_.keys(mockMetricsState.queries), 6);
   _.each(mockMetricsState.queries, (q) => {
     assert.isDefined(q.request);
     assert.isUndefined(q.error);
     assert.isDefined(q.data, "data not defined for query " + q.id);
   });
   // Assert that inFlight is 0.
   assert.equal(mockMetricsState.inFlight, 0);
 });
開發者ID:arjunravinarayan,項目名稱:cockroach,代碼行數:13,代碼來源:metrics.spec.ts

示例3: setTimeout

 p.then(() => {
   assert.lengthOf(fetchMock.calls(uidataPrefixMatcher), 1);
   assert.lengthOf(_.keys(state), 2);
   assert.equal(state[uiKey1].status, uidata.UIDataStatus.LOADING);
   assert.equal(state[uiKey2].status, uidata.UIDataStatus.LOADING);
   assert.isUndefined(state[uiKey1].data);
   assert.isUndefined(state[uiKey2].data);
   assert.notProperty(state[uiKey1], "data");
   assert.notProperty(state[uiKey2], "data");
   assert.isUndefined(state[uiKey1].error);
   assert.isUndefined(state[uiKey2].error);
   setTimeout(
     () => {
       assert.equal(state[uiKey1].status, uidata.UIDataStatus.LOAD_ERROR);
       assert.equal(state[uiKey2].status, uidata.UIDataStatus.LOAD_ERROR);
       assert.instanceOf(state[uiKey1].error, Error);
       assert.instanceOf(state[uiKey2].error, Error);
       done();
     },
     1000,
   );
 });
開發者ID:a6802739,項目名稱:cockroach,代碼行數:22,代碼來源:uiData.spec.ts


注:本文中的src/util/fetch-mock.calls函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。