@@ -26,6 +26,7 @@ describe('sendEmail', () => {
2626 MAILGUN_APIKEY : 'xxx' ,
2727 WEB3MAIL_WHITELISTED_APPS :
2828 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
29+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
2930 } ) ;
3031 // requester secret setup
3132 process . env . IEXEC_REQUESTER_SECRET_1 = JSON . stringify ( {
@@ -54,6 +55,7 @@ describe('sendEmail', () => {
5455 MAILGUN_APIKEY : 'xxx' ,
5556 WEB3MAIL_WHITELISTED_APPS :
5657 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
58+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
5759 } ) ;
5860 await expect ( ( ) => start ( ) ) . rejects . toThrow (
5961 Error ( 'App secret error: "MJ_APIKEY_PUBLIC" is required' )
@@ -69,6 +71,7 @@ describe('sendEmail', () => {
6971 MAILGUN_APIKEY : 'xxx' ,
7072 WEB3MAIL_WHITELISTED_APPS :
7173 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
74+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
7275 } ) ;
7376 await expect ( ( ) => start ( ) ) . rejects . toThrow (
7477 Error ( 'App secret error: "MJ_APIKEY_PRIVATE" is required' )
@@ -84,6 +87,7 @@ describe('sendEmail', () => {
8487 MAILGUN_APIKEY : 'xxx' ,
8588 WEB3MAIL_WHITELISTED_APPS :
8689 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
90+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
8791 } ) ;
8892 await expect ( ( ) => start ( ) ) . rejects . toThrow (
8993 Error ( 'App secret error: "MJ_SENDER" is required' )
@@ -99,6 +103,7 @@ describe('sendEmail', () => {
99103100104 WEB3MAIL_WHITELISTED_APPS :
101105 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
106+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
102107 } ) ;
103108 await expect ( ( ) => start ( ) ) . rejects . toThrow (
104109 Error ( 'App secret error: "MAILGUN_APIKEY" is required' )
@@ -113,6 +118,7 @@ describe('sendEmail', () => {
113118 MJ_APIKEY_PRIVATE : 'xxx' ,
114119 MAILGUN_APIKEY : 'xxx' ,
115120121+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
116122 } ) ;
117123 await expect ( ( ) => start ( ) ) . rejects . toThrow (
118124 Error ( 'App secret error: "WEB3MAIL_WHITELISTED_APPS" is required' )
@@ -121,6 +127,22 @@ describe('sendEmail', () => {
121127 const out = await fsPromises . readdir ( process . env . IEXEC_OUT ) ;
122128 expect ( out ) . toStrictEqual ( [ ] ) ;
123129 } ) ;
130+ it ( 'should fail if POCO_SUBGRAPH_URL in developer secret is missing' , async ( ) => {
131+ process . env . IEXEC_APP_DEVELOPER_SECRET = JSON . stringify ( {
132+ MJ_APIKEY_PUBLIC : 'xxx' ,
133+ MJ_APIKEY_PRIVATE : 'xxx' ,
134+ MAILGUN_APIKEY : 'xxx' ,
135+ 136+ WEB3MAIL_WHITELISTED_APPS :
137+ '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
138+ } ) ;
139+ await expect ( ( ) => start ( ) ) . rejects . toThrow (
140+ Error ( 'App secret error: "POCO_SUBGRAPH_URL" is required' )
141+ ) ;
142+ // output should be empty
143+ const out = await fsPromises . readdir ( process . env . IEXEC_OUT ) ;
144+ expect ( out ) . toStrictEqual ( [ ] ) ;
145+ } ) ;
124146 } ) ;
125147
126148 describe ( 'with bad IEXEC_REQUESTER_SECRET_1' , ( ) => {
@@ -286,6 +308,7 @@ describe('sendEmail', () => {
286308 MAILGUN_APIKEY : 'fake' ,
287309 WEB3MAIL_WHITELISTED_APPS :
288310 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
311+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
289312 } ) ;
290313 // check the error is not an email validation error (mailgun validation is skipped, mailjet rejects)
291314 await expect ( ( ) => start ( ) ) . rejects . toThrow (
@@ -303,6 +326,7 @@ describe('sendEmail', () => {
303326 MAILGUN_APIKEY : 'xxx' ,
304327 WEB3MAIL_WHITELISTED_APPS :
305328 '["0xa638bf4665ce7bd7021a4a12416ea7a0a3272b6f"]' ,
329+ POCO_SUBGRAPH_URL : 'https://fake-poco.subgraph.iex.ec' ,
306330 } ) ;
307331 await expect ( ( ) => start ( ) ) . rejects . toThrow (
308332 Error ( 'Failed to send email' )
0 commit comments