-
Sean Hammond authored
If the tests are grouped according to what class / method / function they're testing, then it's a lot easier to see what is being tested and what isn't, and it's easier to find the tests for `foo()` or to know where to put new tests for `foo()`. On the other hand when you names tests like `describe('channel event handlers',` `describe('event handlers',` `describe('the "loadAnnotations" event',`, `describe('the "deleteAnnotation" event',` etc then it can be a lot harder for a reader coming along later to understand how the tests are organized and how this organization relates to the code itself. Most of the examples on https://mochajs.org/ use this style of organizing tests: describe('Array', function() { describe('#indexOf()', function() { it(... ... }); describe('#concat()', function () { it(... ... }); describe('#slice()', function () { it(... ... }); describe('User', function() { describe('#save()', function() { it(... describe('Connection', function() { describe('#find()', function() { it(... This commit reorganizes the AnnotationSync tests along the same lines. I've also made use of Mocha's `context()` function to group tests **within a `describe()` for a method** by context. `context()` is just an alias for `describe()`, but it has different semantics. (This is also in line with how `context()` is used in the mochajs.org examples).