paint-brush
Simplify Your Server JS Testsby@anatolii
408 reads
408 reads

Simplify Your Server JS Tests

by Anatolii KabanovSeptember 6th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

When you start to write tests you could spread many duplicated rows of your code all over the tests. As an example for testing endpoints of the backend, I use the SuperTest(https://.com/visionmedia/supertest) It provides the ability to send HTTP requests to specific REST APIs. For the backend there can be some general things in the requests. For example Headers of the request. I guess you will require to include some common headers that are used everywhere in your API. Then it will be nice to have a common function for the tests to create a ‘request’ object.
featured image - Simplify Your Server JS Tests
Anatolii Kabanov HackerNoon profile picture
Anatolii Kabanov

Anatolii Kabanov

@anatolii

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

About Author

Anatolii Kabanov HackerNoon profile picture
Anatolii Kabanov@anatolii

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite