@@ -100,15 +100,6 @@ schema.path('date').set(function(v) {
100100 return v ;
101101} ) ;
102102
103- /**
104- * Method subject to hooks. Simply fires the callback once the hooks are
105- * executed.
106- */
107-
108- TestDocument . prototype . hooksTest = function ( fn ) {
109- fn ( null , arguments ) ;
110- } ;
111-
112103const childSchema = new Schema ( { counter : Number } ) ;
113104
114105const parentSchema = new Schema ( {
@@ -433,9 +424,10 @@ describe('document', function() {
433424 delete ret . oids ;
434425 ret . _id = ret . _id . toString ( ) ;
435426 } ;
427+ delete doc . schema . _defaultToObjectOptionsMap ;
436428 clone = doc . toObject ( ) ;
437429 assert . equal ( doc . id , clone . _id ) ;
438- assert . ok ( undefined === clone . em ) ;
430+ assert . strictEqual ( clone . em , undefined ) ;
439431 assert . ok ( undefined === clone . numbers ) ;
440432 assert . ok ( undefined === clone . oids ) ;
441433 assert . equal ( clone . test , 'test' ) ;
@@ -452,6 +444,7 @@ describe('document', function() {
452444 return { myid : ret . _id . toString ( ) } ;
453445 } ;
454446
447+ delete doc . schema . _defaultToObjectOptionsMap ;
455448 clone = doc . toObject ( ) ;
456449 assert . deepEqual ( out , clone ) ;
457450
@@ -489,6 +482,7 @@ describe('document', function() {
489482
490483 // all done
491484 delete doc . schema . options . toObject ;
485+ delete doc . schema . _defaultToObjectOptionsMap ;
492486 } ) ;
493487
494488 it ( 'toObject transform' , async function ( ) {
@@ -884,6 +878,7 @@ describe('document', function() {
884878 } ;
885879
886880 doc . schema . options . toJSON = { virtuals : true } ;
881+ delete doc . schema . _defaultToObjectOptionsMap ;
887882 let clone = doc . toJSON ( ) ;
888883 assert . equal ( clone . test , 'test' ) ;
889884 assert . ok ( clone . oids instanceof Array ) ;
@@ -897,6 +892,7 @@ describe('document', function() {
897892 delete path . casterConstructor . prototype . toJSON ;
898893
899894 doc . schema . options . toJSON = { minimize : false } ;
895+ delete doc . schema . _defaultToObjectOptionsMap ;
900896 clone = doc . toJSON ( ) ;
901897 assert . equal ( clone . nested2 . constructor . name , 'Object' ) ;
902898 assert . equal ( Object . keys ( clone . nested2 ) . length , 1 ) ;
@@ -932,6 +928,7 @@ describe('document', function() {
932928 ret . _id = ret . _id . toString ( ) ;
933929 } ;
934930
931+ delete doc . schema . _defaultToObjectOptionsMap ;
935932 clone = doc . toJSON ( ) ;
936933 assert . equal ( clone . _id , doc . id ) ;
937934 assert . ok ( undefined === clone . em ) ;
@@ -951,6 +948,7 @@ describe('document', function() {
951948 return { myid : ret . _id . toString ( ) } ;
952949 } ;
953950
951+ delete doc . schema . _defaultToObjectOptionsMap ;
954952 clone = doc . toJSON ( ) ;
955953 assert . deepEqual ( out , clone ) ;
956954
@@ -988,6 +986,7 @@ describe('document', function() {
988986
989987 // all done
990988 delete doc . schema . options . toJSON ;
989+ delete doc . schema . _defaultToObjectOptionsMap ;
991990 } ) ;
992991
993992 it ( 'jsonifying an object' , function ( ) {
@@ -998,7 +997,7 @@ describe('document', function() {
998997 // parse again
999998 const obj = JSON . parse ( json ) ;
1000999
1001- assert . equal ( obj . test , 'woot' ) ;
1000+ assert . equal ( obj . test , 'woot' , JSON . stringify ( obj ) ) ;
10021001 assert . equal ( obj . _id , oidString ) ;
10031002 } ) ;
10041003
0 commit comments