Skip to content

Commit

Permalink
remove mocha from test filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
nateps committed May 2, 2016
1 parent 14de14a commit 7bdffb3
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 74 deletions.
File renamed without changes.
8 changes: 6 additions & 2 deletions test/Model/RemoteDoc.mocha.js → test/Model/RemoteDoc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var expect = require('../util').expect;
var racer = require('../../lib/index');
var RemoteDoc = require('../../lib/Model/RemoteDoc');
var docs = require('./docs');

describe('RemoteDoc', function() {
Expand All @@ -10,19 +9,22 @@ describe('RemoteDoc', function() {
var doc = model.getOrCreateDoc('colors', 'green');
doc.create();
return doc;
};
}

describe('create', function() {
it('should set the collectionName and id properties', function() {
var doc = createDoc();
expect(doc.collectionName).to.equal('colors');
expect(doc.id).to.equal('green');
});
});

describe('preventCompose', function() {
beforeEach(function() {
this.backend = racer.createBackend();
this.model = this.backend.createModel();
});

it('composes ops by default', function(done) {
var fido = this.model.at('dogs.fido');
var doc = this.model.connection.get('dogs', 'fido');
Expand All @@ -41,6 +43,7 @@ describe('RemoteDoc', function() {
});
});
});

it('does not compose ops on a model.preventCompose() child model', function(done) {
var fido = this.model.at('dogs.fido').preventCompose();
var doc = this.model.connection.get('dogs', 'fido');
Expand All @@ -59,6 +62,7 @@ describe('RemoteDoc', function() {
});
});
});

it('composes ops on a model.allowCompose() child model', function(done) {
var fido = this.model.at('dogs.fido').preventCompose();
var doc = this.model.connection.get('dogs', 'fido');
Expand Down
3 changes: 0 additions & 3 deletions test/Model/connection.mocha.js → test/Model/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ var expect = require('../util').expect;
var racer = require('../../lib/index');

describe('connection', function() {

describe('getAgent', function() {

it('returns a reference to the ShareDB agent on the server', function() {
var backend = racer.createBackend();
var model = backend.createModel();
Expand All @@ -21,6 +19,5 @@ describe('connection', function() {
done();
});
});

});
});
17 changes: 8 additions & 9 deletions test/Model/events.mocha.js → test/Model/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ var expect = require('../util').expect;
var racer = require('../../lib/index');

describe('Model events', function() {

describe('mutator events', function() {
it('calls earlier listeners in the order of mutations', function(done) {
var model = (new racer.Model).at('_page');
var model = (new racer.Model()).at('_page');
var expectedPaths = ['a', 'b', 'c'];
model.on('change', '**', function(path) {
expect(path).to.equal(expectedPaths.shift());
Expand All @@ -22,7 +21,7 @@ describe('Model events', function() {
model.set('a', 1);
});
it('calls later listeners in the order of mutations', function(done) {
var model = (new racer.Model).at('_page');
var model = (new racer.Model()).at('_page');
model.on('change', 'a', function() {
model.set('b', 2);
});
Expand Down Expand Up @@ -66,7 +65,7 @@ describe('Model events', function() {
describe('move', function() {
it('can move an item from the end to the beginning of the array', function(done) {
this.local.set('array', [0, 1, 2, 3, 4]);
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(4);
expect(to).to.equal(0);
done();
Expand All @@ -75,7 +74,7 @@ describe('Model events', function() {
});
it('can swap the first two items in the array', function(done) {
this.local.set('array', [0, 1, 2, 3, 4], function() {});
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(1);
expect(to).to.equal(0);
done();
Expand All @@ -84,7 +83,7 @@ describe('Model events', function() {
});
it('can move an item from the begnning to the end of the array', function(done) {
this.local.set('array', [0, 1, 2, 3, 4], function() {});
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(0);
expect(to).to.equal(4);
done();
Expand All @@ -93,7 +92,7 @@ describe('Model events', function() {
});
it('supports a negative destination index of -1 (for last)', function(done) {
this.local.set('array', [0, 1, 2, 3, 4], function() {});
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(0);
expect(to).to.equal(4);
done();
Expand All @@ -102,7 +101,7 @@ describe('Model events', function() {
});
it('supports a negative source index of -1 (for last)', function(done) {
this.local.set('array', [0, 1, 2, 3, 4], function() {});
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(4);
expect(to).to.equal(2);
done();
Expand All @@ -112,7 +111,7 @@ describe('Model events', function() {
it('can move several items mid-array, with an event for each', function(done) {
this.local.set('array', [0, 1, 2, 3, 4], function() {});
var events = 0;
this.remote.on('move', '**', function(captures, from, to, howMany, passed) {
this.remote.on('move', '**', function(captures, from, to) {
expect(from).to.equal(1);
expect(to).to.equal(4);
if (++events === 2) {
Expand Down
24 changes: 12 additions & 12 deletions test/Model/filter.mocha.js → test/Model/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ var Model = require('../../lib/Model');
describe('filter', function() {
describe('getting', function() {
it('does not support array', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
model.set('numbers', [0, 3, 4, 1, 2, 3, 0]);
var filter = model.filter('numbers', function(number, i, numbers) {
var filter = model.filter('numbers', function(number) {
return (number % 2) === 0;
});
expect(function() {
filter.get();
}).to.throwException();
});
it('supports filter of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
}
var filter = model.filter('numbers', function(number, id, numbers) {
var filter = model.filter('numbers', function(number) {
return (number % 2) === 0;
});
expect(filter.get()).to.eql([0, 4, 2, 0]);
});
it('supports sort of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand All @@ -36,7 +36,7 @@ describe('filter', function() {
expect(filter.get()).to.eql([4, 3, 3, 2, 1, 0, 0]);
});
it('supports filter and sort of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand All @@ -50,7 +50,7 @@ describe('filter', function() {
});
describe('initial value set by ref', function() {
it('supports filter of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand All @@ -62,7 +62,7 @@ describe('filter', function() {
expect(model.get('out')).to.eql([0, 4, 2, 0]);
});
it('supports sort of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand All @@ -74,7 +74,7 @@ describe('filter', function() {
expect(model.get('out')).to.eql([4, 3, 3, 2, 1, 0, 0]);
});
it('supports filter and sort of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand All @@ -89,12 +89,12 @@ describe('filter', function() {
});
describe('ref updates as items are modified', function() {
it('supports filter of object', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var greenId = model.add('colors', {
name: 'green',
primary: true
});
var orangeId = model.add('colors', {
model.add('colors', {
name: 'orange',
primary: false
});
Expand Down Expand Up @@ -142,7 +142,7 @@ describe('filter', function() {
]);
});
it('supports additional dynamic inputs', function() {
var model = (new Model).at('_page');
var model = (new Model()).at('_page');
var numbers = [0, 3, 4, 1, 2, 3, 0];
for (var i = 0; i < numbers.length; i++) {
model.set('numbers.' + model.id(), numbers[i]);
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7bdffb3

Please sign in to comment.