You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gnd: Add CLI integration tests for drop-in replacement verification
Add test infrastructure to verify gnd works as a drop-in replacement
for graph-cli:
- tests/tests/gnd_cli_tests.rs: Integration tests that run with
GRAPH_CLI pointing to gnd binary, testing codegen/create/deploy
workflow via block-handlers, value-roundtrip, and int8 tests
- gnd/tests/cli_commands.rs: Standalone command tests for init, add,
codegen, build, and clean commands that don't require Graph Node
- justfile: Add test-gnd-cli and test-gnd-commands targets
- Update plan/spec docs with Phase 13: CLI Integration Tests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
-[x] Test scaffold output matches TS CLI - Covered by `just test-gnd-commands` (test_init_from_example, test_init_from_contract_with_abi)
249
250
250
251
### Phase 9: Add Command
251
252
@@ -295,6 +296,72 @@ gnd/src/
295
296
-[x] Migration guide from graph-cli to gnd (differences, compatibility notes)
296
297
-[x] Shell completions (bash, elvish, fish, powershell, zsh via clap_complete)
297
298
299
+
### Phase 13: CLI Integration Tests
300
+
301
+
Verify gnd works as a drop-in replacement for graph-cli by running integration tests with `GRAPH_CLI=../target/debug/gnd`.
302
+
303
+
**Key Insight**: The existing integration test infrastructure uses `CONFIG.graph_cli` which can be set via the `GRAPH_CLI` environment variable. By setting this to the gnd binary, existing integration tests will use gnd for the deployment flow (codegen, create, deploy).
Tests for commands that don't require running graph-node:
322
+
323
+
**`gnd init` Tests**:
324
+
-[x]`test_init_from_example` - Run `gnd init --from-example ethereum-gravatar`, verify scaffold created
325
+
-[x]`test_init_from_contract_with_abi` - Run with `--from-contract` + `--abi`, verify manifest/schema/mapping created
326
+
-[ ]`test_init_from_subgraph` - Run with `--from-subgraph`, verify immutable entities extracted (requires IPFS) - **Skipped**: Requires IPFS with subgraph data
327
+
328
+
**`gnd add` Tests**:
329
+
-[x]`test_add_datasource` - Create base subgraph with init, then add contract, verify manifest updated
330
+
331
+
**`gnd build` Tests**:
332
+
-[x]`test_build_after_codegen` - Copy fixture, run codegen + build, verify `build/` directory created with WASM
333
+
334
+
**`gnd codegen` Tests**:
335
+
-[x]`test_codegen_generates_types` - Run codegen on scaffolded subgraph, verify `generated/schema.ts` exists
336
+
337
+
**`gnd clean` Tests**:
338
+
-[x]`test_clean_removes_artifacts` - Verify clean removes `generated/` and `build/` directories
339
+
340
+
**ABIs Available**: `tests/contracts/abis/*.json`
341
+
342
+
#### Justfile Targets
343
+
344
+
-[x] Add `test-gnd-cli` - Run gnd CLI integration tests (deployment with gnd as CLI)
Copy file name to clipboardExpand all lines: docs/specs/gnd-cli-expansion.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -698,6 +698,39 @@ Fixtures can be regenerated with `./tests/fixtures/regenerate.sh`.
698
698
699
699
When edge case bugs are discovered in the TS CLI, gnd should fix them rather than replicate them. Document any behavioral differences that result from bug fixes.
700
700
701
+
### CLI Integration Tests
702
+
703
+
Located in `tests/tests/gnd_cli_tests.rs`, these tests verify gnd works as a drop-in replacement for graph-cli by running the integration test suite with `GRAPH_CLI` environment variable pointing to the gnd binary.
704
+
705
+
**How it works:**
706
+
- The integration test infrastructure uses `CONFIG.graph_cli` for deployment commands
707
+
- Setting `GRAPH_CLI=../target/debug/gnd` makes tests use gnd instead of graph-cli
0 commit comments