Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: node_js
node_js:
- 9
- 8
- 6
- 4
- "10"
- "8"
- "6"
script: "npm run test-cover"
# Send coverage data to Coveralls
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"coveralls": "^2.11.8",
"expect.js": "^0.3.1",
"istanbul": "^0.4.2",
"mocha": "^2.3.3"
"mocha": "^2.3.3",
"sharedb": "^1.0.0-beta"
},
"author": "Avital Oliver",
"license": "MIT",
Expand All @@ -25,7 +26,9 @@
},
"homepage": "https://github.com/share/sharedb-mingo-memory#readme",
"dependencies": {
"mingo": "^2.2.0",
"mingo": "^2.2.0"
},
"peerDependencies": {
"sharedb": "^1.0.0-beta"
}
}
10 changes: 8 additions & 2 deletions test/query.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
var expect = require('expect.js');
var async = require('async');

var sortSnapshot = function(snapshots) {
return snapshots.sort(function (a, b) {
return (a.id > b.id) ? 1 : ((b.id > a.id) ? -1 : 0);
});
}

// Call this function inside a `describe` block. Assumes that
// `this.db` is set to be a ShareDB instance that supports certain
// Mongo queries.
Expand Down Expand Up @@ -109,7 +115,7 @@ module.exports = function() {
it('top-level boolean operator', function(done) {
this.db.query('testcollection', {$or: [{y: 1}, {_id: 'test2'}]}, null, null, function(err, results, extra) {
if (err) throw err;
expect(results).eql([snapshotsNoMeta[0], snapshotsNoMeta[1]]);
expect(sortSnapshot(results)).eql(sortSnapshot([snapshotsNoMeta[0], snapshotsNoMeta[1]]));
done();
});
});
Expand Down Expand Up @@ -162,7 +168,7 @@ module.exports = function() {
it('$or', function(done) {
this.db.query('testcollection', {$or: [{x: 1}, {y: 1}], $sort: {_id: 1}}, null, null, function(err, results, extra) {
if (err) throw err;
expect(results).eql([snapshots[0], snapshots[1]]);
expect(sortSnapshot(results)).eql(sortSnapshot([snapshots[0], snapshots[1]]));
done();
});
});
Expand Down