Socket
Book a DemoInstallSign in
Socket

aws-mockify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-mockify

## General

latest
Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

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([credentials[, options]])

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);
});

You can also pass in an options object to set the version to AWS SDK v3:

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

const ddb = new MOCKAWS.DynamoDB(undefined, {"version": 3});
ddb.getItem({"Key": {"id": {"N": "1"}}, "TableName": "User"}).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();

FAQs

Package last updated on 12 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.