当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-saga-test-plan.expectSaga函数代码示例

本文整理汇总了TypeScript中redux-saga-test-plan.expectSaga函数的典型用法代码示例。如果您正苦于以下问题:TypeScript expectSaga函数的具体用法?TypeScript expectSaga怎么用?TypeScript expectSaga使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了expectSaga函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it("immediately runs a saga when refresh is called", function() {
     return expectSaga(queryManagerSaga)
         .dispatch(refresh(testQueryCounter))
         .run()
         .then(() => {
             assert.equal(queryCounterCalled, 1);
         });
 });
开发者ID:asubiotto,项目名称:cockroach,代码行数:8,代码来源:saga.spec.ts

示例2: it

      it("correctly accumulates batches", function () {
        const requestAction = metrics.requestMetrics("id", createRequest(shortTimespan, "short.1"));
        const beginAction = metrics.beginMetrics(requestAction.payload.id, requestAction.payload.data);

        return expectSaga(metrics.queryMetricsSaga)
          // Stub out calls to batchAndSendRequests.
          .provide([
            [matchers.call.fn(metrics.batchAndSendRequests), null],
          ])
          // Dispatch six requests, with delays inserted in order to trigger
          // batch sends.
          .dispatch(requestAction)
          .dispatch(requestAction)
          .dispatch(requestAction)
          .delay(0)
          .dispatch(requestAction)
          .delay(0)
          .dispatch(requestAction)
          .dispatch(requestAction)
          .run()
          .then((result) => {
            const { effects } = result;
            // Verify the order of call dispatches.
            assert.deepEqual(
              effects.call,
              [
                call(delay, 0),
                call(metrics.batchAndSendRequests, [requestAction.payload, requestAction.payload, requestAction.payload]),
                call(delay, 0),
                call(metrics.batchAndSendRequests, [requestAction.payload]),
                call(delay, 0),
                call(metrics.batchAndSendRequests, [requestAction.payload, requestAction.payload]),
              ],
            );
            // Verify that all beginAction puts were dispatched.
            assert.deepEqual(
              effects.put,
              [
                put(beginAction),
                put(beginAction),
                put(beginAction),
                put(beginAction),
                put(beginAction),
                put(beginAction),
              ],
            );
          });
      });
开发者ID:a6802739,项目名称:cockroach,代码行数:48,代码来源:metrics.spec.ts


注:本文中的redux-saga-test-plan.expectSaga函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。