Skip to content

Commit

Permalink
chore: fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daprahamian committed Mar 5, 2019
1 parent 7bb9c57 commit 5a69b8b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/extended_json.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ function serializeDocument(doc, options) {
return doc.toExtendedJSON(options);
}
// TODO: should we throw an exception if there's a BSON type that has no toExtendedJSON method?
}
}

// Recursively serialize this document's property values.
// Recursively serialize this document's property values.
const _doc = {};
for (let name in doc) {
_doc[name] = serializeValue(doc[name], options);
Expand Down
9 changes: 5 additions & 4 deletions test/node/extended_json_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ const Timestamp = BSON.Timestamp;
function getOldObjectID() {
try {
// do a dynamic resolve to avoid exception when running browser tests
const file = require.resolve('mongodb');
const file = require.resolve('mongodb');
return require(file).ObjectID;
}
catch (e) {
} catch (e) {
return ObjectId; // if mongo is unavailable, e.g. browsers, just re-use BSON's
}
}
Expand Down Expand Up @@ -309,7 +308,9 @@ describe('Extended JSON', function() {
serialized = EJSON.stringify(doc, replacerArray);
expect(serialized).to.equal('{"a":10}');

var replacerFunc = function (key, value) { return key === 'b' ? undefined : value; }
var replacerFunc = function(key, value) {
return key === 'b' ? undefined : value;
};
serialized = EJSON.stringify(doc, replacerFunc, 0, { relaxed: false });
expect(serialized).to.equal('{"a":{"$numberInt":"10"}}');

Expand Down
4 changes: 3 additions & 1 deletion test/node/object_id_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ describe('ObjectId', function() {

it('should correctly interpret timestamps beyond 2038', function() {
var farFuture = new Date('2040-01-01T00:00:00.000Z').getTime();
expect(new BSON.ObjectId(BSON.ObjectId.generate(farFuture/1000)).getTimestamp().getTime()).to.equal(farFuture);
expect(
new BSON.ObjectId(BSON.ObjectId.generate(farFuture / 1000)).getTimestamp().getTime()
).to.equal(farFuture);
});
});

0 comments on commit 5a69b8b

Please sign in to comment.