@@ -5,6 +5,7 @@ import nock from 'nock';
55import { app as expressApp } from '../../masterExpressApp' ;
66import { AppMode , MasterExpressConfig , TlsMode } from '../../types' ;
77import { Environments } from '@bitgo/sdk-core' ;
8+ import assert from 'assert' ;
89
910describe ( 'POST /api/:coin/wallet/generate' , ( ) => {
1011 let agent : request . SuperAgentTest ;
@@ -45,8 +46,6 @@ describe('POST /api/:coin/wallet/generate', () => {
4546 const userKeychainNock = nock ( enclavedExpressUrl )
4647 . post ( `/api/${ coin } /key/independent` , {
4748 source : 'user' ,
48- coin : coin ,
49- type : 'independent' ,
5049 } )
5150 . reply ( 200 , {
5251 pub : 'xpub_user' ,
@@ -57,8 +56,6 @@ describe('POST /api/:coin/wallet/generate', () => {
5756 const backupKeychainNock = nock ( enclavedExpressUrl )
5857 . post ( `/api/${ coin } /key/independent` , {
5958 source : 'backup' ,
60- coin : coin ,
61- type : 'independent' ,
6259 } )
6360 . reply ( 200 , {
6461 pub : 'xpub_backup' ,
@@ -155,18 +152,11 @@ describe('POST /api/:coin/wallet/generate', () => {
155152 allowSelfSigned : true ,
156153 } ;
157154
158- const app = expressApp ( invalidConfig as MasterExpressConfig ) ;
159- const testAgent = request . agent ( app ) ;
160-
161- const response = await testAgent
162- . post ( `/api/${ coin } /wallet/generate` )
163- . set ( 'Authorization' , `Bearer ${ accessToken } ` )
164- . send ( {
165- label : 'test-wallet' ,
166- } ) ;
167-
168- response . status . should . equal ( 500 ) ;
169- response . body . should . have . property ( 'error' ) ;
170- response . body . error . should . equal ( 'Please configure enclaved express configs.' ) ;
155+ try {
156+ expressApp ( invalidConfig as MasterExpressConfig ) ;
157+ assert ( false , 'Expected error to be thrown when enclaved express client is not configured' ) ;
158+ } catch ( e ) {
159+ ( e as Error ) . message . should . equal ( 'enclavedExpressUrl and enclavedExpressCert are required' ) ;
160+ }
171161 } ) ;
172162} ) ;
0 commit comments