Skip to content

Instantly share code, notes, and snippets.

View DHANRAJCHOUDHARY244's full-sized avatar
🎯
Focusing

DHANRAJ CHOUDHARY DHANRAJCHOUDHARY244

🎯
Focusing
View GitHub Profile
@DHANRAJCHOUDHARY244
DHANRAJCHOUDHARY244 / NodeJsUnitTesting.md
Last active July 3, 2024 11:51
NodeJs Unit testing (Mocha/chai vs Jest and Jasmine) complete guide

Comprehensive Guide to Node.js Unit Testing

Unit testing is a crucial practice in software development that ensures individual components of an application work as expected. This guide covers everything know about unit testing in Node.js, including a comparison between Mocha/Chai and Jest, and information on additional useful packages like Nock, Sinon, Mocha Awesome, NYC, and Chai-HTTP.

Why Unit Testing is Necessary

1. Early Bug Detection

Unit testing helps identify issues early in the development cycle when they are easier and cheaper to fix. By writing tests for each unit of code, you can catch bugs as soon as they are introduced, preventing them from propagating to other parts of the application.

@ygotthilf
ygotthilf / jwtRS256.sh
Last active July 25, 2024 11:09
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub