@@ -3,7 +3,7 @@ import { ValidationError } from 'yup';
33import { type SendEmail } from '../../src/web3mail/sendEmail.js' ;
44import { getRandomAddress , TEST_CHAIN } from '../test-utils.js' ;
55import { mockAllForSendEmail } from '../utils/mockAllForSendEmail.js' ;
6- import { DEFAULT_CHAIN_ID , getChainConfig } from '../../src/config/config.js' ;
6+ import { DEFAULT_CHAIN_ID , getChainDefaultConfig } from '../../src/config/config.js' ;
77
88jest . unstable_mockModule ( '../../src/utils/subgraphQuery.js' , ( ) => ( {
99 checkProtectedDataValidity : jest . fn ( ) ,
@@ -175,22 +175,31 @@ describe('sendEmail', () => {
175175 graphQLClient : { } ,
176176 // @ts -expect-error No need for iexec here
177177 iexec,
178- ipfsGateway : getChainConfig ( DEFAULT_CHAIN_ID ) . ipfsGateway ,
179- ipfsNode : getChainConfig ( DEFAULT_CHAIN_ID ) . ipfsUploadUrl ,
180- workerpoolAddressOrEns : getChainConfig ( DEFAULT_CHAIN_ID ) . prodWorkerpoolAddress ,
181- dappAddressOrENS : getChainConfig ( DEFAULT_CHAIN_ID ) . dappAddress ,
182- dappWhitelistAddress : getChainConfig ( DEFAULT_CHAIN_ID ) . whitelistSmartContract . toLowerCase ( ) ,
178+ ipfsGateway : getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ? .ipfsGateway ,
179+ ipfsNode : getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ? .ipfsUploadUrl ,
180+ workerpoolAddressOrEns : getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ? .prodWorkerpoolAddress ,
181+ dappAddressOrENS : getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ? .dappAddress ,
182+ dappWhitelistAddress : getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ? .whitelistSmartContract . toLowerCase ( ) ,
183183 emailSubject : 'e2e mail object for test' ,
184184 emailContent : OVERSIZED_CONTENT ,
185185 protectedData,
186186 } ) ;
187187
188188 // --- THEN
189+ const defaultConfig = getChainDefaultConfig ( DEFAULT_CHAIN_ID ) ;
190+ expect ( defaultConfig ) . not . toBeNull ( ) ;
191+ const mockConfig = {
192+ ipfsGateway : defaultConfig ! . ipfsGateway ,
193+ ipfsNode : defaultConfig ! . ipfsUploadUrl ,
194+ workerpoolAddressOrEns : defaultConfig ! . prodWorkerpoolAddress ,
195+ dappAddressOrENS : defaultConfig ! . dappAddress ,
196+ dappWhitelistAddress : defaultConfig ! . whitelistSmartContract . toLowerCase ( ) ,
197+ } ;
189198 expect ( iexec . orderbook . fetchWorkerpoolOrderbook ) . toHaveBeenNthCalledWith (
190199 1 ,
191200 {
192201 workerpool : TEST_CHAIN . prodWorkerpool ,
193- app : getChainConfig ( DEFAULT_CHAIN_ID ) . dappAddress . toLowerCase ( ) ,
202+ app : defaultConfig ! . dappAddress . toLowerCase ( ) ,
194203 dataset : protectedData ,
195204 requester : userAddress ,
196205 isRequesterStrict : false ,
@@ -203,7 +212,7 @@ describe('sendEmail', () => {
203212 2 ,
204213 {
205214 workerpool : TEST_CHAIN . prodWorkerpool ,
206- app : getChainConfig ( DEFAULT_CHAIN_ID ) . whitelistSmartContract . toLowerCase ( ) ,
215+ app : defaultConfig ! . whitelistSmartContract . toLowerCase ( ) ,
207216 dataset : protectedData ,
208217 requester : userAddress ,
209218 isRequesterStrict : false ,
0 commit comments