Unit Testing Made Easier With Pure Functionsby@marcinwosinek

Unit Testing Made Easier With Pure Functions

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Unit tests are small pieces of code that verify units of your code against explicit expectations. You write your code to give yourself a way of checking your code automatically. In real-world JavaScript projects, people usually use open-source frameworks for testing. In this article, for simplicity, I’ll use pseudocode inspired by those frameworks. Pure functions are functions whose results depend only on the arguments that were provided. They don't keep internal state, and they don't read external values besides arguments. They are the same as functions in the mathematical sense.

People Mentioned

Mention Thumbnail
featured image - Unit Testing Made Easier With Pure Functions
Marcin Wosinek HackerNoon profile picture

@marcinwosinek

Marcin Wosinek

I'm a JavaScript developer. I'm here to teach you useful skills, so you can succeed in your work & private projects.


Receive Stories from @marcinwosinek

react to story with heart
Marcin Wosinek HackerNoon profile picture
by Marcin Wosinek @marcinwosinek.I'm a JavaScript developer. I'm here to teach you useful skills, so you can succeed in your work & private projects.
Newsletter

RELATED STORIES

L O A D I N G
. . . comments & more!