@@ -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' ) ;
@@ -161,3 +161,15 @@ assert(sortedArrayJson.indexOf('"a"') < sortedArrayJson.indexOf('"z"'), 'Array.t
161161assert ( sortedArrayJson . indexOf ( '"b"' ) < sortedArrayJson . indexOf ( '"y"' ) , 'Array.tojson with sortedKeys=true should sort object keys in array elements' ) ;
162162assert ( unsortedArrayJson . indexOf ( '"z"' ) < unsortedArrayJson . indexOf ( '"a"' ) , 'Array.tojson with sortedKeys=false should not sort keys' ) ;
163163assert ( defaultArrayJson . indexOf ( '"z"' ) < defaultArrayJson . indexOf ( '"a"' ) , 'Array.tojson without sortedKeys should not sort keys' ) ;
164+
165+ // Test MinKey
166+ const minKey = new MinKey ( ) ;
167+ assert ( minKey instanceof MinKey , "minKey should be an instance of MinKey" ) ;
168+ assert . strictEqual ( minKey . tojson ( ) , '{ "$minKey" : 1 }' , "minKey should serialize correctly" ) ;
169+ assert . strictEqual ( minKey . toString ( ) , "[object Function]" , "minKey toString should work" ) ;
170+ assert . strictEqual ( minKey . toJSON ( ) , '{ "$minKey" : 1 }' , "minKey toJSON should work" ) ;
171+
172+ // Test that multiple references return the same instance
173+ const anotherMinKeyRef = new MinKey ( ) ;
174+ assert . strictEqual ( minKey , anotherMinKeyRef , "minKey should be a singleton - v1" ) ;
175+ assert . strictEqual ( MinKey ( ) , MinKey ( ) , "minKey should be a singleton - v2" ) ;
0 commit comments