Articles

Creating stubs and spies
Aug 7th, 2020

Dependencies are an integral part of most codebases. They come in different forms: internal dependencies : our own modules (functions and classes), used by other parts of our code external dependencies : modules exposed by libraries, frameworks etc physical dependencies : database, network connection etc In unit testing, we want to test modules (units) "in a vacuum" in order to quickly and…

An overview of test double theory and Sinon.js practice
Jul 20th, 2020

Why test doubles? Dependencies are an integral part of most codebases. They come in different forms: internal dependencies: modules (functions and classes) used by the rest of the code external dependencies: modules exposed by libraries, frameworks etc physical dependencies: file system, database, network connection etc The goal of unit testing is testing modules (units) "in a vacuum" in order to…

Using the popular testing framework in real-life scenarios
Jul 6th, 2020

Disclaimer: this is not an article for testing mocha coffee recipes. We are talking about Mocha.js , a popular JavaScript testing framework. Mocha is usually combined with Chai.js , an assertion library (damn, this article already feels like an actual recipe cookbook!) Together with Sinon.js , a mocking library, they can deal with a big portion of unit tests. In this article, we will go…

Leverage serverless computing with AWS Lambda
Jun 28th, 2020

AWS Lambda is a flexible and cost effective service which allows you to implement back-end functionality in a serverless environment. In this tutorial we will learn how to invoke a Lambda function. There are mainly two way to do that: Manually (using a test event) Programmatically We will use JavaScript / Node.js in the code snippets, but their logic should be easily transferable to the rest of…

Automate your Lambda function deployment with a bash script
Jun 21st, 2020

AWS Lambda is a flexible and cost effective service which allows you to implement back-end functionality in a serverless environment. In this tutorial we will create a script to automate the deployment of Lambda functions. Apart from an AWS account, we will also need The Lambda function name (ARN) and region. We can find the ARN by selecting our lambda function in the AWS Lambda service. The…