Skip to content

Commit 6290e03

Browse files
committed
add tests
1 parent 70ee0b8 commit 6290e03

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

packages/cli/tests/cli/__snapshots__/init.test.ts.snap

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,3 +285,35 @@ Next steps:
285285
Make sure to visit the documentation on https://thegraph.com/docs/ for further information.
286286
"
287287
`;
288+
289+
exports[`Init > Substreams > From package 1`] = `
290+
" › Warning: The --skip-git flag will be removed in the next major version. By
291+
› default we will stop initializing a Git repository.
292+
- Create subgraph scaffold
293+
Generate subgraph
294+
- Create subgraph scaffold
295+
Write subgraph to directory
296+
- Create subgraph scaffold
297+
✔ Create subgraph scaffold
298+
- Install dependencies with yarn
299+
✔ Install dependencies with yarn
300+
"
301+
`;
302+
303+
exports[`Init > Substreams > From package 2`] = `0`;
304+
305+
exports[`Init > Substreams > From package 3`] = `
306+
"
307+
Subgraph user/subgraph-from-substreams created in from-package
308+
309+
Next steps:
310+
311+
1. Run \`graph auth\` to authenticate with your deploy key.
312+
313+
2. Type \`cd from-package\` to enter the subgraph.
314+
315+
3. Run \`yarn deploy\` to deploy the subgraph.
316+
317+
Make sure to visit the documentation on https://thegraph.com/docs/ for further information.
318+
"
319+
`;

packages/cli/tests/cli/init.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,33 @@ describe.sequential(
210210
},
211211
);
212212
});
213+
214+
describe('Substreams', () => {
215+
const substreamsBaseDir = path.join(baseDir, 'substreams');
216+
217+
cliTest(
218+
'From package',
219+
[
220+
'init',
221+
'--skip-git',
222+
'--protocol',
223+
'substreams',
224+
'--spkg',
225+
path.join(substreamsBaseDir, 'substreams.spkg'),
226+
'--network',
227+
'mainnet',
228+
'user/subgraph-from-substreams',
229+
path.join(substreamsBaseDir, 'from-package'),
230+
],
231+
path.join('init', 'substreams', 'from-package'),
232+
{
233+
exitCode: 0,
234+
timeout: 100_000,
235+
cwd: substreamsBaseDir,
236+
deleteDir: true,
237+
},
238+
);
239+
});
213240
},
214241
{
215242
timeout: 60_000,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test file, nothing to see here

0 commit comments

Comments
 (0)