@@ -1778,12 +1778,41 @@ describe('codec', () => {
17781778 } ) ;
17791779 } ) ;
17801780
1781- it ( 'should determine if the uuid value is unspecified ' , ( ) => {
1781+ it ( 'should determine if the uuid value is string ' , ( ) => {
17821782 assert . deepStrictEqual ( codec . getType ( uuid . v4 ( ) ) , {
1783- type : 'unspecified ' ,
1783+ type : 'string ' ,
17841784 } ) ;
17851785 } ) ;
17861786
1787+ it ( 'should determine if the uuid value is unspecified when SPANNER_ENABLE_UUID_AS_UNTYPED is true' , ( ) => {
1788+ const emitWarningStub = sandbox . stub ( process , 'emitWarning' ) ;
1789+ try {
1790+ process . env [ 'SPANNER_ENABLE_UUID_AS_UNTYPED' ] = 'true' ;
1791+ assert . deepStrictEqual ( codec . getType ( uuid . v4 ( ) ) , {
1792+ type : 'unspecified' ,
1793+ } ) ;
1794+ assert . strictEqual ( emitWarningStub . calledOnce , true ) ;
1795+ assert . strictEqual (
1796+ emitWarningStub . firstCall . args [ 0 ] ,
1797+ 'SPANNER_ENABLE_UUID_AS_UNTYPED environment variable is deprecated and will be removed in a future release.' ,
1798+ ) ;
1799+ } finally {
1800+ delete process . env [ 'SPANNER_ENABLE_UUID_AS_UNTYPED' ] ;
1801+ emitWarningStub . restore ( ) ;
1802+ }
1803+ } ) ;
1804+
1805+ it ( 'should determine if the uuid value is string when SPANNER_ENABLE_UUID_AS_UNTYPED is false' , ( ) => {
1806+ try {
1807+ process . env [ 'SPANNER_ENABLE_UUID_AS_UNTYPED' ] = 'false' ;
1808+ assert . deepStrictEqual ( codec . getType ( uuid . v4 ( ) ) , {
1809+ type : 'string' ,
1810+ } ) ;
1811+ } finally {
1812+ delete process . env [ 'SPANNER_ENABLE_UUID_AS_UNTYPED' ] ;
1813+ }
1814+ } ) ;
1815+
17871816 it ( 'should determine if the value is a float32' , ( ) => {
17881817 assert . deepStrictEqual ( codec . getType ( new codec . Float32 ( 1.1 ) ) , {
17891818 type : 'float32' ,
0 commit comments