@@ -2403,7 +2403,11 @@ describe('POST /api/v1/:coin/advancedwallet/generate', () => {
24032403 const asyncApp = expressApp ( asyncConfig ) ;
24042404 const asyncAgent = request . agent ( asyncApp ) ;
24052405
2406- const bridgeNock = nock ( bridgeUrl ) . post ( `/api/${ coin } /key/independent` ) . reply ( 202 , { jobId } ) ;
2406+ const bridgeNock = nock ( bridgeUrl )
2407+ . post ( `/api/${ coin } /key/independent` )
2408+ . matchHeader ( 'X-OSO-Source' , 'user,backup' )
2409+ . matchHeader ( 'X-OSO-Operation' , 'multisig_keygen' )
2410+ . reply ( 202 , { jobId } ) ;
24072411
24082412 const response = await asyncAgent
24092413 . post ( `/api/v1/${ coin } /advancedwallet/generate` )
@@ -2432,4 +2436,81 @@ describe('POST /api/v1/:coin/advancedwallet/generate', () => {
24322436 'EVM keyring wallet generation is not supported for coin tbtc' ,
24332437 ) ;
24342438 } ) ;
2439+
2440+ it ( 'should fail when async mode is enabled for TSS wallet generation' , async ( ) => {
2441+ const bridgeUrl = 'http://bridge.invalid' ;
2442+ sinon . restore ( ) ;
2443+ const asyncBitgo = new BitGoAPI ( { env : 'test' } ) ;
2444+ const asyncConfig = makeConfig ( {
2445+ asyncModeConfig : {
2446+ enabled : true ,
2447+ awmAsyncUrl : bridgeUrl ,
2448+ pollIntervalInMs : 30000 ,
2449+ jobTtlInSeconds : 3600 ,
2450+ jobTtlMpcInSeconds : 7200 ,
2451+ } ,
2452+ } ) ;
2453+
2454+ sinon . stub ( middleware , 'prepareBitGo' ) . callsFake ( ( ) => ( req , _res , next ) => {
2455+ ( req as BitGoRequest < MasterExpressConfig > ) . bitgo = asyncBitgo ;
2456+ ( req as BitGoRequest < MasterExpressConfig > ) . config = asyncConfig ;
2457+ next ( ) ;
2458+ } ) ;
2459+
2460+ const asyncApp = expressApp ( asyncConfig ) ;
2461+ const asyncAgent = request . agent ( asyncApp ) ;
2462+
2463+ const response = await asyncAgent
2464+ . post ( `/api/v1/${ eddsaCoin } /advancedwallet/generate` )
2465+ . set ( 'Authorization' , `Bearer ${ accessToken } ` )
2466+ . send ( {
2467+ label : 'test_wallet' ,
2468+ enterprise : 'test_enterprise' ,
2469+ multisigType : 'tss' ,
2470+ } ) ;
2471+
2472+ response . status . should . equal ( 400 ) ;
2473+ response . body . details . should . containEql (
2474+ 'Async mode is not yet supported for TSS wallet generation' ,
2475+ ) ;
2476+ } ) ;
2477+
2478+ it ( 'should fail when async mode is enabled for EVM keyring wallet generation' , async ( ) => {
2479+ const bridgeUrl = 'http://bridge.invalid' ;
2480+ sinon . restore ( ) ;
2481+ const asyncBitgo = new BitGoAPI ( { env : 'test' } ) ;
2482+ const asyncConfig = makeConfig ( {
2483+ asyncModeConfig : {
2484+ enabled : true ,
2485+ awmAsyncUrl : bridgeUrl ,
2486+ pollIntervalInMs : 30000 ,
2487+ jobTtlInSeconds : 3600 ,
2488+ jobTtlMpcInSeconds : 7200 ,
2489+ } ,
2490+ } ) ;
2491+
2492+ sinon . stub ( middleware , 'prepareBitGo' ) . callsFake ( ( ) => ( req , _res , next ) => {
2493+ ( req as BitGoRequest < MasterExpressConfig > ) . bitgo = asyncBitgo ;
2494+ ( req as BitGoRequest < MasterExpressConfig > ) . config = asyncConfig ;
2495+ next ( ) ;
2496+ } ) ;
2497+
2498+ const asyncApp = expressApp ( asyncConfig ) ;
2499+ const asyncAgent = request . agent ( asyncApp ) ;
2500+
2501+ const response = await asyncAgent
2502+ . post ( `/api/v1/eth/advancedwallet/generate` )
2503+ . set ( 'Authorization' , `Bearer ${ accessToken } ` )
2504+ . send ( {
2505+ label : 'test_wallet' ,
2506+ enterprise : 'test_enterprise' ,
2507+ multisigType : 'onchain' ,
2508+ evmKeyRingReferenceWalletId : '59cd72485007a239fb00282ed480da1f' ,
2509+ } ) ;
2510+
2511+ response . status . should . equal ( 400 ) ;
2512+ response . body . details . should . containEql (
2513+ 'Async mode is not yet supported for EVM keyring wallet generation' ,
2514+ ) ;
2515+ } ) ;
24352516} ) ;
0 commit comments