如果要调用Amazon的Cognito函数,我想用sinon进行测试。下面是我要测试的代码:
const AWS = require("aws-sdk");
const AWSCognito = new AWS.CognitoIdentityServiceProvider();
const myFunction= (a, b, c, d) => {
let params = {
AuthFlow: "ADMIN_NO_SRP_AUTH",
ClientId: b,
UserPoolId: a,
AuthParameters: {
USERNAME: c,
PASSWORD: d
}
};
return AWSCognito.adminInitiateAuth(params).promise();
};
是否已经用sinon调用过adminInitiateAuth中的测试方法?