Skip to content

bespoken-cookbook/mock-alexa-dynamo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Mock Alexa Dynamo

For users of the Alexa Node.js SDK.

Super simple library for mocking out Dynamo dependency.

Installation

To use it, install with:
npm install mock-alexa-dynamo --save

Usage

Initialize

Then enable:

const mockDynamo = require("mock-alexa-dynamo");
mockDynamo.enable();

Presetting State

State can be pre-configured at the start by calling the load method:

mockDynamo.load("USER_ID", { userInfo: {} })

This would typically be called in a beforeEach block in a unit-test.

Resetting State

Between tests, to reset the state, just call:

mockDynamo.reset();

Typically, this would be placed inside a afterEach method in a unit-test.

Example

To see a full example, check out the Giftionary project:
https://github.com/bespoken/giftionary

In particular, this test:
https://github.com/bespoken/giftionary/blob/master/test/index.test.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published