@@ -3,7 +3,7 @@ import * as assert from 'assert';
33import * as utxolib from '@bitgo/utxo-lib' ;
44import { Wallet } from '@bitgo/sdk-core' ;
55
6- import { AbstractUtxoCoin , TxFormat } from '../../src' ;
6+ import { AbstractUtxoCoin , ErrorDeprecatedTxFormat , TxFormat } from '../../src' ;
77
88import { utxoCoins , defaultBitGo } from './util' ;
99
@@ -151,7 +151,8 @@ describe('txFormat', function () {
151151
152152 // Test explicitly requested formats
153153 runTest ( {
154- description : 'should respect explicitly requested legacy format' ,
154+ description : 'should respect explicitly requested legacy format on mainnet' ,
155+ coinFilter : ( coin ) => utxolib . isMainnet ( coin . network ) ,
155156 expectedTxFormat : 'legacy' ,
156157 requestedTxFormat : 'legacy' ,
157158 } ) ;
@@ -167,5 +168,21 @@ describe('txFormat', function () {
167168 expectedTxFormat : 'psbt-lite' ,
168169 requestedTxFormat : 'psbt-lite' ,
169170 } ) ;
171+
172+ // Test that legacy format is prohibited on testnet
173+ it ( 'should throw ErrorDeprecatedTxFormat when legacy format is requested on testnet' , function ( ) {
174+ for ( const coin of utxoCoins ) {
175+ if ( ! utxolib . isTestnet ( coin . network ) ) {
176+ continue ;
177+ }
178+
179+ const wallet = createMockWallet ( coin , { type : 'hot' } ) ;
180+ assert . throws (
181+ ( ) => getTxFormat ( coin , wallet , 'legacy' ) ,
182+ ErrorDeprecatedTxFormat ,
183+ `Expected ErrorDeprecatedTxFormat for ${ coin . getChain ( ) } `
184+ ) ;
185+ }
186+ } ) ;
170187 } ) ;
171188} ) ;
0 commit comments