Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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),
},
},
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()
})
}
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()
}
})
})
...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,
[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()
})
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();
});