From the course: Learning Node.js

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Simple test with Jasmine

Simple test with Jasmine - Node.js Tutorial

From the course: Learning Node.js

Simple test with Jasmine

- [Instructor] You might have heard of testing, unit tests and test-driven development. They are all related, and we will take a look at how to work with these using Node and a test framework called Jasmine. There are a few other options like Mocha, but Jasmine comes with everything you need to get started without much setup. Let's consider a simple requirement. Let's say we have a product manager or owner that will give a programmer a simple requirement, such as, "When I go to this endpoint," "localhost port 3000/messages," "I expect to get a list of messages." That, by definition, is a requirement of the application. But, this can also be a test. We could make a test that automatically opens up a connection, then checks if it receives a list with more than zero messages. This is exactly what the tester and possibly product owner and product manager would do once the programmer delivers the feature. It would go through that test manually. Jasmine, on the other hand, can automate that…

Contents