Skip to content

Testing Components

Components have three tiers of testing: local validation, doctor diagnostics, and end-to-end verification.

Before installing, validate the manifest offline:

Terminal window
wh component validate ./my-component

This checks:

  1. Schema validationcomponent.json and manifest.json structure
  2. Cross-reference validation — subscriptions reference existing actions, actions reference existing credentials, seeds reference existing shapes
  3. ID format validation — reverse-DNS format check
  4. Consistency checkcomponent.json id/name must match manifest.json component section
  5. File reference checks — warns if action args reference missing local files

Test the install pipeline against a real repo without pushing to GitHub:

Terminal window
wh component install ./my-component --repo org/test-repo

After install, run doctor to verify all declared resources exist:

Terminal window
wh component doctor my-component --repo org/test-repo

Doctor checks:

  • Shapes — exist and are active
  • Subscriptions — exist and are active
  • Credential sets — exist with all required keys populated

Doctor operates on the installed manifest snapshot. It does not compare against the source or auto-remediate. If resources are missing, reinstall or create them manually.

The full verification path:

Terminal window
# For components without subscriptions, local path works:
wh component install ./my-component --repo org/test-repo
# For components with subscriptions, use the GitHub URL:
wh component install github.com/owner/my-component --repo org/test-repo
Terminal window
wh credential set my-creds api_key --value "sk-..." --repo org/test-repo
Terminal window
wh component doctor my-component --repo org/test-repo
# Should report "ready"

For event-driven subscriptions, create a thing on the trigger shape:

Terminal window
wh commit create --repo org/test-repo \
--ops '[{"operation":"add","kind":"thing","name":"Echo/test-1","data":{"message":"hello","tags":["test"]}}]'

For cron subscriptions, there is no wh sub trigger command yet. To test manually, create a temporary event-driven subscription with the same command and action, trigger it by writing a thing to its watched shape, verify the output, then delete the temporary subscription.

Check that the expected output things were created:

Terminal window
wh thing query --shape EchoResult --repo org/test-repo

Check subscription delivery logs:

Terminal window
wh sub log se/echo-handler --repo org/test-repo

After local testing passes, push to GitHub and verify the remote install path:

Terminal window
# Push to GitHub
git push origin main
# Install from GitHub URL
wh component install github.com/owner/my-component --repo org/test-repo
# Run doctor again
wh component doctor my-component --repo org/test-repo