Skip to content

Commit

Permalink
tests; add example of nested schemas working
Browse files Browse the repository at this point in the history
closes #1
  • Loading branch information
aheckmann committed Jul 8, 2013
1 parent 82928cb commit c496a91
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/index.js
Expand Up @@ -90,6 +90,19 @@ describe('Double', function(){
done();
});
})

it('casts within subdocs', function(done){
var v = '2000000.00';
var nested = new Schema({ double: Double });
var schema = new Schema({ docs: [nested] });
var M = db.model('subdocs', schema);
var m = new M({ docs: [{ double: v }] });
assert.ok(m.docs[0].double instanceof mongoose.Types.Double);
m.save(function (err) {
assert.ifError(err);
done();
});
})
})

it('can be saved', function(done){
Expand Down

0 comments on commit c496a91

Please sign in to comment.