Unit tests are very useful for checking how our app is working.
Otherwise, we run into all kinds of issues later on.
In this article, we’ll look at some best practices we should follow when writing JavaScript unit tests.
We should tag our tests so that they can run when commits are being made or builds are being run.
This way, we can, we can do sanity checks before we commit anything by running the most critical tests.
For instance, we can write:
describe("user service", function() {
describe("log in #sanity", function() {
test("can log in with the right username and password #sanity", function() {
//...
});
});
});
#javascript #testing