• Sean Hammond's avatar
    Reorganize AnnotationSync tests by method · 90535d22
    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).
    90535d22
Name
Last commit
Last update
.github Loading commit data...
docs Loading commit data...
images Loading commit data...
scripts Loading commit data...
src Loading commit data...
.eslintignore Loading commit data...
.eslintrc Loading commit data...
.gitignore Loading commit data...
.npmignore Loading commit data...
.npmrc Loading commit data...
.travis.yml Loading commit data...
CHANGELOG.md Loading commit data...
CODE_OF_CONDUCT Loading commit data...
Jenkinsfile Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
gulpfile.js Loading commit data...
npm-shrinkwrap.json Loading commit data...
package.json Loading commit data...
requirements-dev.in Loading commit data...