@@ -188,4 +188,43 @@ describe('IExecDataProtector()', () => {
188188 } ) ;
189189 } ) ;
190190 } ) ;
191+
192+ describe ( 'When instantiating SDK with an experimental network' , ( ) => {
193+ const experimentalNetworkSigner = getWeb3Provider (
194+ Wallet . createRandom ( ) . privateKey ,
195+ {
196+ host : 421614 ,
197+ allowExperimentalNetworks : true ,
198+ }
199+ ) ;
200+
201+ describe ( 'Without allowExperimentalNetworks' , ( ) => {
202+ it ( 'should throw a configuration error' , async ( ) => {
203+ const dataProtector = new IExecDataProtector ( experimentalNetworkSigner ) ;
204+ await expect ( dataProtector [ 'init' ] ( ) ) . rejects . toThrow (
205+ 'Missing required configuration for chainId 421614: subgraphUrl, dataprotectorContractAddress, sharingContractAddress, ipfsGateway, defaultWorkerpool, ipfsNode, smsDebugURL'
206+ ) ;
207+ } ) ;
208+ } ) ;
209+
210+ describe ( 'With allowExperimentalNetworks: true' , ( ) => {
211+ it ( 'should resolve the configuration' , async ( ) => {
212+ const dataProtector = new IExecDataProtector (
213+ experimentalNetworkSigner ,
214+ { allowExperimentalNetworks : true }
215+ ) ;
216+ await expect ( dataProtector [ 'init' ] ( ) ) . resolves . toBeUndefined ( ) ;
217+ expect ( dataProtector [ 'arweaveUploadApi' ] ) . toBeDefined ( ) ;
218+ expect ( dataProtector [ 'dataprotectorContractAddress' ] ) . toBeDefined ( ) ;
219+ expect ( dataProtector [ 'defaultWorkerpool' ] ) . toBeDefined ( ) ;
220+ expect ( dataProtector [ 'ethProvider' ] ) . toBeDefined ( ) ;
221+ expect ( dataProtector [ 'graphQLClient' ] ) . toBeDefined ( ) ;
222+ expect ( dataProtector [ 'iexec' ] ) . toBeDefined ( ) ;
223+ expect ( dataProtector [ 'iexecDebug' ] ) . toBeDefined ( ) ;
224+ expect ( dataProtector [ 'ipfsGateway' ] ) . toBeDefined ( ) ;
225+ expect ( dataProtector [ 'ipfsNode' ] ) . toBeDefined ( ) ;
226+ expect ( dataProtector [ 'sharingContractAddress' ] ) . toBeDefined ( ) ;
227+ } ) ;
228+ } ) ;
229+ } ) ;
191230} ) ;
0 commit comments