@@ -1384,6 +1384,36 @@ describe('TinyInt', function() {
13841384} ) ;
13851385
13861386describe ( 'TVP' , function ( ) {
1387+ describe ( '.declaration' , function ( ) {
1388+ it ( 'returns type name with readonly' , function ( ) {
1389+ const result = TYPES . TVP . declaration ( {
1390+ value : { name : 'MyTableType' , schema : '' , columns : [ ] , rows : [ ] }
1391+ } as any ) ;
1392+ assert . strictEqual ( result , 'MyTableType readonly' ) ;
1393+ } ) ;
1394+
1395+ it ( 'includes schema when present' , function ( ) {
1396+ const result = TYPES . TVP . declaration ( {
1397+ value : { name : 'UDT_StringArray' , schema : 'AI' , columns : [ ] , rows : [ ] }
1398+ } as any ) ;
1399+ assert . strictEqual ( result , 'AI.UDT_StringArray readonly' ) ;
1400+ } ) ;
1401+
1402+ it ( 'works with null schema' , function ( ) {
1403+ const result = TYPES . TVP . declaration ( {
1404+ value : { name : 'MyTableType' , schema : null , columns : [ ] , rows : [ ] }
1405+ } as any ) ;
1406+ assert . strictEqual ( result , 'MyTableType readonly' ) ;
1407+ } ) ;
1408+
1409+ it ( 'works with undefined schema' , function ( ) {
1410+ const result = TYPES . TVP . declaration ( {
1411+ value : { name : 'MyTableType' , columns : [ ] , rows : [ ] }
1412+ } as any ) ;
1413+ assert . strictEqual ( result , 'MyTableType readonly' ) ;
1414+ } ) ;
1415+ } ) ;
1416+
13871417 describe ( '.generateParameterLength' , function ( ) {
13881418 it ( 'returns the correct data length' , function ( ) {
13891419 assert . deepEqual ( TYPES . TVP . generateParameterLength ( { value : null } , options ) , Buffer . from ( [ 0xFF , 0xFF ] ) ) ;
0 commit comments