Testing Components
Components have three tiers of testing: local validation, doctor diagnostics, and end-to-end verification.
Local Validation
Section titled “Local Validation”Before installing, validate the manifest offline:
wh component validate ./my-componentThis checks:
- Schema validation —
component.jsonandmanifest.jsonstructure - Cross-reference validation — subscriptions reference existing actions, actions reference existing credentials, seeds reference existing shapes
- ID format validation — reverse-DNS format check
- Consistency check —
component.jsonid/name must matchmanifest.jsoncomponent section - File reference checks — warns if action args reference missing local files
Install from Local Path
Section titled “Install from Local Path”Test the install pipeline against a real repo without pushing to GitHub:
wh component install ./my-component --repo org/test-repoDoctor Diagnostics
Section titled “Doctor Diagnostics”After install, run doctor to verify all declared resources exist:
wh component doctor my-component --repo org/test-repoDoctor 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.
End-to-End Testing
Section titled “End-to-End Testing”The full verification path:
1. Install the Component
Section titled “1. Install the Component”# 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-repo2. Bind Credentials
Section titled “2. Bind Credentials”wh credential set my-creds api_key --value "sk-..." --repo org/test-repo3. Verify Doctor
Section titled “3. Verify Doctor”wh component doctor my-component --repo org/test-repo# Should report "ready"4. Trigger the Action
Section titled “4. Trigger the Action”For event-driven subscriptions, create a thing on the trigger shape:
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.
5. Verify Output
Section titled “5. Verify Output”Check that the expected output things were created:
wh thing query --shape EchoResult --repo org/test-repoCheck subscription delivery logs:
wh sub log se/echo-handler --repo org/test-repoGitHub Install Test
Section titled “GitHub Install Test”After local testing passes, push to GitHub and verify the remote install path:
# Push to GitHubgit push origin main
# Install from GitHub URLwh component install github.com/owner/my-component --repo org/test-repo
# Run doctor againwh component doctor my-component --repo org/test-repo