aws-mockify

    1.0.0 • Public • Published

    aws-mockify

    General

    aws-mockify is a mock system for the AWS-SDK package in Node.js.

    APIs

    MOCKAWS.mock(service, action, callback)

    This function is the entry point to creating a new mock. Define the AWS service, action, and pass in a callback that will be called with the params and a callback function to handle the request.

    const MOCKAWS = require("aws-mockify");
    MOCKAWS.mock("DynamoDB", "getItem", (params, callback) => {
        callback(null, {
            "Item": {
                "id": {
                    "N": "1"
                }
            }
        });
    });

    new MOCKAWS.service()

    This function allows you to create a new instance of an aws-mockify service.

    const MOCKAWS = require("aws-mockify");
     
    const ddb = new MOCKAWS.DynamoDB();
    ddb.getItem({"Key": {"id": {"N": "1"}}, "TableName": "User"}).promise().then((item) => {
        console.log(item);
    });

    MOCKAWS.restore()

    This function removes all the existing MOCKAWS.mock calls that are stored in the system.

    const MOCKAWS = require("aws-mockify");
     
    MOCKAWS.restore();

    Keywords

    none

    Install

    npm i aws-mockify

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    3.56 kB

    Total Files

    4

    Last publish

    Collaborators

    • fishcharlie