Skip to Main Content
Implementing AWS: Design, Build, and Manage your Infrastructure
book

Implementing AWS: Design, Build, and Manage your Infrastructure

by Yohan Wadia, Rowan Udell, Lucas Chan, Udita Gupta
January 2019
Intermediate to advanced content levelIntermediate to advanced
690 pages
16h
English
Packt Publishing
Content preview from Implementing AWS: Design, Build, and Manage your Infrastructure

Testing functions with Mocha and Chai

The first step to creating a continuously deployable Lambda function is to write unit tests. One of the easiest and simplest ways to do so is by using a combination of two frameworks called Mocha and Chai.

First, a little bit about the two frameworks without going into too much information:

  • Mocha: Mocha is a simple test framework for Node.js created to be easily extensible and fast for testing. It is used for unit and integration testing. You can read more about it at https://mochajs.org/. Mocha provides a unique ability to describe the features that we are implementing in our code by giving us a describe function that encapsulates our expectations:
 describe('myLambda',function(){ //assertions about ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

AWS Account Setup Best Practices

AWS Account Setup Best Practices

Chad Smith
AWS Administration Cookbook

AWS Administration Cookbook

Rowan Udell, Lucas Chan

Publisher Resources

ISBN: 9781788835770OtherErrata Page