Skip to content

Commit

Permalink
test was testing something wrong. fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rueckstiess committed Sep 10, 2015
1 parent df09df6 commit 9706554
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions test/ejson-objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,45 @@ var BSON = require('bson');
var EJSON = require('mongodb-extended-json');

/*eslint new-cap: 0, quote-props: 0*/
describe('objectid docs', function() {
describe('jeff\'s docs', function() {
var schema;
var docs = [
{
'_id': BSON.ObjectID('55e6484748f15136d28b6e76')
},
{
'_id': BSON.ObjectID('55f0a1ca62510c0b042b59e8'),
'arr1': [1, 2, 3],
'arr2': [true, false],
'arr3': [{ 'c': 1, 'd': 2 }, { 'c': 1, 'e': 3 }, { 'e': 3 }],
'doc': { 'a': 1, 'b': 2 },
'x': 1
},
{
'_id': BSON.ObjectID('55f0a1ca62510c0b042b59e9'),
'arr1': [1, 2, 3],
'arr2': [true, false],
'arr3': [{ 'c': 1, 'd': 2 }, { 'c': 1, 'e': 3 }, { 'e': 3 }],
'doc': { 'a': 1, 'b': 2 },
'x': 1
},
{
'_id': BSON.ObjectID('55f0a1ca62510c0b042b59ea'),
'arr1': [1, 2, 3],
'arr2': [true, false],
'arr3': [{ 'c': 1, 'd': 2 }, { 'c': 1, 'e': 3 }, { 'e': 3 }],
'doc': { 'a': 1, 'b': 2 },
'x': 1
}
];

before(function(done) {
schema = getSchema('single objectid', docs, function() {
schema = getSchema('jeff', docs, function() {
done();
});
});
it('should be serializable by JSON and EJSON', function() {
// console.log(JSON.stringify(schema, null, ' '));
assert.ok(JSON.stringify(schema)); // passes
assert.ok(EJSON.stringify(schema)); // fails
it('should be able to serialize these docs in JSON and EJSON', function() {
assert.ok(JSON.stringify(schema.serialize()));
assert.ok(EJSON.stringify(schema.serialize()));
});
});

0 comments on commit 9706554

Please sign in to comment.