测试亚马逊的Cognito

时间:2018-12-10 10:42:04

标签: javascript testing amazon-cognito sinon

如果要调用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中的测试方法?

0 个答案:

没有答案