@@ -87,7 +87,7 @@ const tsFromStr = Timestamp.fromString('ff', 16);
8787assert . strictEqual ( tsFromStr . i , 255 ) ;
8888assert . strictEqual ( tsFromStr . t , 0 ) ;
8989assert . strictEqual ( Timestamp . MAX_VALUE . _bsontype , 'Long' ) ;
90- assert . strictEqual ( Timestamp . MAX_VALUE , Long . MAX_UNSIGNED_VALUE ) ;
90+ assert . strictEqual ( Timestamp . MAX_VALUE , Long . MAX_UNSIGNED_VALUE ) ;
9191
9292const id = ObjectId ( '68ffa28b77bba38c9ddcf376' ) ;
9393const dbRef = DBRef ( 'testColl' , id , 'testDb' ) ;
@@ -131,3 +131,15 @@ try {
131131}
132132assert . strictEqual ( typeof tojsonObject ( { key : "value" } ) , 'string' ) ;
133133assert . strictEqual ( typeof tojsonObject ( [ 1 , 2 , 3 ] ) , 'string' ) ;
134+
135+ // Test MinKey
136+ const minKey = new MinKey ( ) ;
137+ assert ( minKey instanceof MinKey , "minKey should be an instance of MinKey" ) ;
138+ assert . strictEqual ( minKey . tojson ( ) , '{ "$minKey" : 1 }' , "minKey should serialize correctly" ) ;
139+ assert . strictEqual ( minKey . toString ( ) , "[object Function]" , "minKey toString should work" ) ;
140+ assert . strictEqual ( minKey . toJSON ( ) , '{ "$minKey" : 1 }' , "minKey toJSON should work" ) ;
141+
142+ // Test that multiple references return the same instance
143+ const anotherMinKeyRef = new MinKey ( ) ;
144+ assert . strictEqual ( minKey , anotherMinKeyRef , "minKey should be a singleton - v1" ) ;
145+ assert . strictEqual ( MinKey ( ) , MinKey ( ) , "minKey should be a singleton - v2" ) ;
0 commit comments