@@ -31,7 +31,7 @@ describe('BSON e2e', function () {
3131 await client . close ( ) ;
3232 } ) ;
3333
34- describe ( 'printed BSON' , function ( ) {
34+ describe . only ( 'printed BSON' , function ( ) {
3535 const outputDoc = {
3636 ObjectId : "ObjectId('5f16b8bebe434dc98cdfc9ca')" ,
3737 DBRef1 : "DBRef('a', ObjectId('5f16b8bebe434dc98cdfc9cb'), 'db')" ,
@@ -349,6 +349,13 @@ describe('BSON e2e', function () {
349349 expect ( await shell . executeLine ( value ) ) . to . include ( value ) ;
350350 shell . assertNoErrors ( ) ;
351351 } ) ;
352+ it ( 'BinData type 4 prints as UUID when valid' , async function ( ) {
353+ const value = "BinData(4, 'ASNFZ4mrze8BI0VniavN7w==')" ;
354+ expect ( await shell . executeLine ( value ) ) . to . include (
355+ "UUID('01234567-89ab-cdef-0123-456789abcdef')"
356+ ) ;
357+ shell . assertNoErrors ( ) ;
358+ } ) ;
352359 it ( 'BinData prints as MD5 when created by user as such' , async function ( ) {
353360 const value = "MD5('0123456789abcdef0123456789abcdef')" ;
354361 expect ( await shell . executeLine ( value ) ) . to . include ( value ) ;
@@ -380,43 +387,43 @@ describe('BSON e2e', function () {
380387 ) ;
381388 shell . assertNoErrors ( ) ;
382389 } ) ;
383- it ( 'LegacyJavaUUID prints when created by user' , async function ( ) {
390+ it ( 'LegacyJavaUUID prints as Binary subtype 3 when created by user' , async function ( ) {
384391 const value = 'LegacyJavaUUID()' ;
385392 const output = await shell . executeLine ( value ) ;
386- expect ( output ) . to . match (
387- / L e g a c y J a v a U U I D \( ' [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } ' \) /
388- ) ;
393+ expect ( output ) . to . match ( / B i n a r y \. c r e a t e F r o m B a s e 6 4 \( ' .+ ' , 3 \) / ) ;
389394 shell . assertNoErrors ( ) ;
390395 } ) ;
391- it ( 'LegacyCSharpUUID prints when created by user' , async function ( ) {
396+ it ( 'LegacyCSharpUUID prints as Binary subtype 3 when created by user' , async function ( ) {
392397 const value = 'LegacyCSharpUUID()' ;
393398 const output = await shell . executeLine ( value ) ;
394- expect ( output ) . to . match (
395- / L e g a c y C S h a r p U U I D \( ' [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } ' \) /
396- ) ;
399+ expect ( output ) . to . match ( / B i n a r y \. c r e a t e F r o m B a s e 6 4 \( ' .+ ' , 3 \) / ) ;
397400 shell . assertNoErrors ( ) ;
398401 } ) ;
399- it ( 'LegacyPythonUUID prints when created by user' , async function ( ) {
402+ it ( 'LegacyPythonUUID prints as Binary subtype 3 when created by user' , async function ( ) {
400403 const value = 'LegacyPythonUUID()' ;
401404 const output = await shell . executeLine ( value ) ;
402- expect ( output ) . to . match (
403- / L e g a c y P y t h o n U U I D \( ' [ 0 - 9 a - f ] { 8 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 4 } - [ 0 - 9 a - f ] { 12 } ' \) /
404- ) ;
405+ expect ( output ) . to . match ( / B i n a r y \. c r e a t e F r o m B a s e 6 4 \( ' .+ ' , 3 \) / ) ;
405406 shell . assertNoErrors ( ) ;
406407 } ) ;
407- it ( 'BinData prints as LegacyJavaUUID when created by user as such ' , async function ( ) {
408+ it ( 'BinData created as LegacyJavaUUID prints as Binary subtype 3 ' , async function ( ) {
408409 const value = "LegacyJavaUUID('01234567-89ab-cdef-0123-456789abcdef')" ;
409- expect ( await shell . executeLine ( value ) ) . to . include ( value ) ;
410+ expect ( await shell . executeLine ( value ) ) . to . include (
411+ "Binary.createFromBase64('782riWdFIwHvzauJZ0UjAQ==', 3)"
412+ ) ;
410413 shell . assertNoErrors ( ) ;
411414 } ) ;
412- it ( 'BinData prints as LegacyCSharpUUID when created by user as such ' , async function ( ) {
415+ it ( 'BinData created as LegacyCSharpUUID prints as Binary subtype 3 ' , async function ( ) {
413416 const value = "LegacyCSharpUUID('01234567-89ab-cdef-0123-456789abcdef')" ;
414- expect ( await shell . executeLine ( value ) ) . to . include ( value ) ;
417+ expect ( await shell . executeLine ( value ) ) . to . include (
418+ "Binary.createFromBase64('Z0UjAauJ780BI0VniavN7w==', 3)"
419+ ) ;
415420 shell . assertNoErrors ( ) ;
416421 } ) ;
417- it ( 'BinData prints as LegacyPythonUUID when created by user as such ' , async function ( ) {
422+ it ( 'BinData created as LegacyPythonUUID prints as Binary subtype 3 ' , async function ( ) {
418423 const value = "LegacyPythonUUID('01234567-89ab-cdef-0123-456789abcdef')" ;
419- expect ( await shell . executeLine ( value ) ) . to . include ( value ) ;
424+ expect ( await shell . executeLine ( value ) ) . to . include (
425+ "Binary.createFromBase64('ASNFZ4mrze8BI0VniavN7w==', 3)"
426+ ) ;
420427 shell . assertNoErrors ( ) ;
421428 } ) ;
422429 } ) ;
0 commit comments