Skip to content

test(hello-solana): assert the greeting log instead of only tx success#105

Merged
mikemaccana merged 2 commits into
mainfrom
claude/harden-weak-tests
Jul 7, 2026
Merged

test(hello-solana): assert the greeting log instead of only tx success#105
mikemaccana merged 2 commits into
mainfrom
claude/harden-weak-tests

Conversation

@mikemaccana

Copy link
Copy Markdown
Collaborator

Why

hello-solana logs a message and changes no state, so a test that only checks the transaction landed verifies nothing about the program's actual behavior — the skill calls these out as not-real tests. Each flavor now asserts the program emitted Hello, Solana!.

Changes

  • anchor — kite's send_transaction_from_instructions returns Result<(), _> and discards the metadata (and logs). Send through LiteSVM directly instead (adds a solana-transaction dev-dep) and assert the greeting appears in metadata.logs.
  • native — was assert!(...is_ok()); now captures the result and asserts the log.
  • quasar — asserts result.logs contains the greeting after assert_success().
  • pinocchio — already asserted the log; unchanged.

Verification

The anchor rewrite was type-checked with cargo check --tests (against a placeholder .so so include_bytes! resolves — the sbf toolchain isn't available locally, so full execution is left to CI). The native and quasar changes mirror log-asserting patterns already used elsewhere in the repo (pinocchio hello-solana; repository-layout/quasar).

This covers the clearly-weak hello-solana family. If you want, I can sweep for other assert-only tests in a follow-up.

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 7, 2026 18:02
hello-solana only logs a message and changes no state, so a test that just
checks the transaction landed verifies nothing about the program. Assert each
flavor emits 'Hello, Solana!':

- anchor: kite's send helper discards transaction metadata, so send through
  LiteSVM directly (adds a solana-transaction dev-dep) and read the logs.
- native: capture the send result and assert the log (was is_ok only).
- quasar: assert on result.logs after assert_success.

pinocchio already asserted the log. anchor verified with cargo check --tests;
native/quasar mirror existing log-asserting tests in the repo.
Wrap the metadata.logs method chain to satisfy cargo fmt --check.
@mikemaccana mikemaccana merged commit 5939a69 into main Jul 7, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants