当前位置: 首页>>代码示例>>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;未经允许,请勿转载。