Describing Tests
- Label tests with descriptive texts rather than function names
describe('sorting the list of users', function() { it('sorts in descending order by default', function() { ... }); });
Unit Tests | E2E Tests | |
---|---|---|
What they interact with | application code, e.g., a test will call a component function and inspect the HTML returned | application user interface, e.g., a test will open a URL and click on a button |
Expected time to run | microseconds | seconds or more |
Isolating from databases and services | Mock objects | Emulators, testbed databases, mock service workers |
describe('sorting the list of users', function() { it('sorts in descending order by default', function() { ... }); });
expect(isLeapYear(2000)).toBe(true);
toHaveBeenCalled()
toString
Thanks to Hakim El Hattab for RevealJS