@@ -8,39 +8,43 @@ const EXAMPLE_SUBGRAPH_PATH = path.join(__dirname, 'add', 'subgraph');
88
99const  TEMP_SUBGRAPH_PATH  =  path . join ( __dirname ,  'add' ,  'tmp-subgraph' ) ; 
1010
11- describe ( 'Add command' ,  ( )  =>  { 
12-   beforeAll ( async  ( )  =>  { 
13-     toolbox . filesystem . remove ( TEMP_SUBGRAPH_PATH ) ;  // If the tests fail before AfterAll is called 
14-     toolbox . filesystem . copy ( EXAMPLE_SUBGRAPH_PATH ,  TEMP_SUBGRAPH_PATH ) ; 
15- 
16-     await  runGraphCli ( 
17-       [ 
18-         'add' , 
19-         '0x2E645469f354BB4F5c8a05B3b30A929361cf77eC' , 
20-         '--contract-name' , 
21-         'Gravatar' , 
22-         '--abi' , 
23-         `${ EXAMPLE_SUBGRAPH_PATH }  /abis/Gravity.json` , 
24-       ] , 
25-       TEMP_SUBGRAPH_PATH , 
26-     ) ; 
27-   } ) ; 
28- 
29-   afterAll ( async  ( )  =>  { 
30-     toolbox . filesystem . remove ( TEMP_SUBGRAPH_PATH ) ; 
31-   } ) ; 
32- 
33-   it ( 'should add a new datasource to a subgraph' ,  ( )  =>  { 
34-     const  manifest  =  fs . readFileSync ( `${ TEMP_SUBGRAPH_PATH }  /subgraph.yaml` ) ; 
35-     const  expected  =  fs . readFileSync ( `${ __dirname }  /add/expected/subgraph.yaml` ) ; 
36- 
37-     expect ( manifest . equals ( expected ) ) . toBe ( true ) ; 
38-   } ) ; 
39- 
40-   it ( 'should not overwrite the ABI file' ,  ( )  =>  { 
41-     const  abi  =  fs . readFileSync ( `${ TEMP_SUBGRAPH_PATH }  /abis/Gravatar.json` ) ; 
42-     const  expected  =  fs . readFileSync ( `${ __dirname }  /add/expected/Gravatar.json` ) ; 
43- 
44-     expect ( expected . equals ( abi ) ) . toBe ( true ) ; 
45-   } ) ; 
46- } ,  {  timeout : 20_000  } ) ; 
11+ describe ( 
12+   'Add command' , 
13+   ( )  =>  { 
14+     beforeAll ( async  ( )  =>  { 
15+       toolbox . filesystem . remove ( TEMP_SUBGRAPH_PATH ) ;  // If the tests fail before AfterAll is called 
16+       toolbox . filesystem . copy ( EXAMPLE_SUBGRAPH_PATH ,  TEMP_SUBGRAPH_PATH ) ; 
17+ 
18+       await  runGraphCli ( 
19+         [ 
20+           'add' , 
21+           '0x2E645469f354BB4F5c8a05B3b30A929361cf77eC' , 
22+           '--contract-name' , 
23+           'Gravatar' , 
24+           '--abi' , 
25+           `${ EXAMPLE_SUBGRAPH_PATH }  /abis/Gravity.json` , 
26+         ] , 
27+         TEMP_SUBGRAPH_PATH , 
28+       ) ; 
29+     } ) ; 
30+ 
31+     afterAll ( async  ( )  =>  { 
32+       toolbox . filesystem . remove ( TEMP_SUBGRAPH_PATH ) ; 
33+     } ) ; 
34+ 
35+     it ( 'should add a new datasource to a subgraph' ,  ( )  =>  { 
36+       const  manifest  =  fs . readFileSync ( `${ TEMP_SUBGRAPH_PATH }  /subgraph.yaml` ) ; 
37+       const  expected  =  fs . readFileSync ( `${ __dirname }  /add/expected/subgraph.yaml` ) ; 
38+ 
39+       expect ( manifest . equals ( expected ) ) . toBe ( true ) ; 
40+     } ) ; 
41+ 
42+     it ( 'should not overwrite the ABI file' ,  ( )  =>  { 
43+       const  abi  =  fs . readFileSync ( `${ TEMP_SUBGRAPH_PATH }  /abis/Gravatar.json` ) ; 
44+       const  expected  =  fs . readFileSync ( `${ __dirname }  /add/expected/Gravatar.json` ) ; 
45+ 
46+       expect ( expected . equals ( abi ) ) . toBe ( true ) ; 
47+     } ) ; 
48+   } , 
49+   {  timeout : 20_000  } , 
50+ ) ; 
0 commit comments