Practical Unit Testing

Image for post
Image for post
Image by 3D Animation Production Company from Pixabay

Updated Version


const map1 = new Map();

If we delete the entry with index 2 the remaining indexes are [3,4] . We want a function that calculates this result and we want unit tests for it.


Notice that the way we documented our function makes it easy to unit test it.

Here’s the unit test. Note that we are testing edge conditions:

Related Concepts

Brought to You By Firefly Semantics

Founder of Firefly Semantics Corporation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store