How to use the redux-saga-test-plan/matchers.call function in redux-saga-test-plan

To help you get started, we’ve selected a few redux-saga-test-plan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cockroachdb / cockroach-gen / pkg / ui / src / redux / metrics.spec.ts View on Github external
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, [
                delay(0),
github sovrin-foundation / connector-app / app / store / __tests__ / connections-store.spec.js View on Github external
},
      },
      user: {
        userOneTimeInfo,
      },
      config: configStoreNotHydratedInstalledVcxInit,
    }

    return expectSaga(
      deleteConnectionOccurredSaga,
      deleteConnectionAction(connection.senderDID)
    )
      .withState(stateWithConnection)
      .provide([
        [matchers.call.like({ fn: deleteConnection }), true],
        [matchers.call.fn(secureSet, CONNECTIONS, '{}'), true],
      ])
      .call.like({ fn: deleteConnection })
      .call(secureSet, CONNECTIONS, '{}')
      .put(deleteConnectionSuccess({}))
      .run()
  })
github sovrin-foundation / connector-app / app / invitation / __tests__ / invitation-store.spec.js View on Github external
}
      const connectionHandle = 1

      return expectSaga(sendResponse, sendInvitationResponse(data))
        .withState(vcxInitSuccessWithInvitationState)
        .provide([
          [
            matchers.call.fn(createConnectionWithInvite, payload),
            connectionHandle,
          ],
          [
            matchers.call.fn(acceptInvitationVcx, connectionHandle),
            myPairWiseConnectionDetails,
          ],
          [
            matchers.call.fn(serializeConnection, connectionHandle),
            vcxSerializedConnection,
          ],
        ])
        .put(invitationSuccess(senderDID))
        .put(
          saveNewConnection({
            newConnection: {
              ...successConnectionData.newConnection,
              vcxSerializedConnection,
            },
          })
        )
        .run()
    }
  })
})
github sovrin-foundation / connector-app / app / claim-offer / __tests__ / claim-offer-store.spec.js View on Github external
...pairwiseConnection,
            senderDID: claimOfferPayload.remotePairwiseDID,
            vcxSerializedConnection: vcxSerializedConnection,
          },
        },
      },
    }
    const claimHandle = 1
    const connectionHandle = 1
    const paymentHandle = 0

    return expectSaga(claimOfferAccepted, acceptClaimOffer(uid))
      .withState(stateWithClaimOfferAndSerialized)
      .provide([
        [
          matchers.call.fn(
            getHandleBySerializedConnection,
            vcxSerializedConnection
          ),
          connectionHandle,
        ],
        [
          matchers.call.fn(
            getClaimHandleBySerializedClaimOffer,
            claimOfferSerialized
          ),
          claimHandle,
        ],
        [
          matchers.call.fn(
            sendClaimRequestApi,
            claimHandle,
github sovrin-foundation / connector-app / app / store / __tests__ / connections-store.spec.js View on Github external
[connection.identifier]: connection,
        },
      },
      user: {
        userOneTimeInfo,
      },
      config: configStoreNotHydratedInstalledVcxInit,
    }

    return expectSaga(
      deleteConnectionOccurredSaga,
      deleteConnectionAction(connection.senderDID)
    )
      .withState(stateWithConnection)
      .provide([
        [matchers.call.like({ fn: deleteConnection }), true],
        [matchers.call.fn(secureSet, CONNECTIONS, '{}'), true],
      ])
      .call.like({ fn: deleteConnection })
      .call(secureSet, CONNECTIONS, '{}')
      .put(deleteConnectionSuccess({}))
      .run()
  })
github cockroachdb / cockroach-gen / pkg / ui / cluster-ui / src / store / nodes / nodes.sagas.spec.ts View on Github external
it("successfully requests nodes list", () => {
      expectSaga(requestNodesSaga)
        .provide([[matchers.call.fn(getNodes), nodesResponse]])
        .put(actions.received(nodes))
        .withReducer(reducer)
        .hasFinalState({
          data: nodes,
          lastError: null,
          valid: true,
        })
        .run();
    });