From the course: Node.js: Testing and Code Quality
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Assertions for correctness
From the course: Node.js: Testing and Code Quality
Assertions for correctness
- [Instructor] Determining if actual output matches the expected is a requirement for testing if a system is working correctly. Assertion libraries are the solution, but what are they? As you may recall, an assertion validates the correctness of a unit of code. Assertions declare that a given predicate is going to be Boolean true. For example, here's an assertion that 'dog' is strictly equal to 'cat.' In this case, the assertion will throw an error because the string literals do not match. All right. So what's an assertion library? An assertion library is a collection of assertions. Typically many more than what's in Node.js's assert module. They support comparisons of many different types of language structures like objects or rays, Booleans, numbers and more. Like a framework, assertion libraries provide an API, or in some cases multiple APIs for developers to create predicates. The APIs provide interfaces and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
What is code quality?6m 57s
-
(Locked)
Coding conventions and standards6m 38s
-
(Locked)
Creating and enforcing coding standards7m 27s
-
(Locked)
Unit, integration, and functional testing10m 30s
-
(Locked)
Testing frameworks5m 53s
-
(Locked)
TDD and BDD test specifications5m 12s
-
(Locked)
Assertions for correctness4m 32s
-
(Locked)
Challenge: Organize your tests58s
-
(Locked)
Solution: Organize your tests1m 46s
-
-
-
-
-
-