Skip to content

Add staging integration test suite for status history - #2

Merged
darreneid merged 1 commit into
stagingfrom
staging-test-suite
Jul 28, 2026
Merged

Add staging integration test suite for status history#2
darreneid merged 1 commit into
stagingfrom
staging-test-suite

Conversation

@darreneid

Copy link
Copy Markdown
Collaborator

What

A standalone integration suite (test/staging/run.mjs) that exercises the community-custom-fields status-history feature against a live Discourse instance over the HTTP API. Complements the unit/system specs and the feature in #1.

How it works

  • Drives the real surfaces as both an admin and a non-admin customer (via Api-Username on a global key): POST /posts.json, the admin PUT custom-fields endpoint, and GET /t/:id.json.
  • Verifies both layers: the observable topic custom_fields state machine, and the actual rows written to community_custom_fields_topic_status_changes, read back through Data Explorer (creates a temp parameterized query, runs it per topic, deletes it on teardown).
  • Config via env; Node ≥ 18, zero dependencies. Creates and cleans up its own test topics.

Checks

topic_created seeds new + no row · api_update row (user/no-post/duration) · invalid status → 422 + nothing · no-op status → no row · customer reply reopens snoozed (post_id/null user/pre-change assignee) · admin whisper reopen (skips if whispers off) · admin reply clears waiting → no row · all valid statuses accepted.

Requirements

An admin — ideally "All Users" (global) — API key, and discourse-data-explorer enabled on the target. See test/staging/README.md.

Testing

Validated against a local Discourse dev instance (real HTTP + real rows): 8/8 pass, cleanup confirmed. Lives under test/staging/ as .mjs, outside the plugin's lint globs, so it doesn't affect CI.

🤖 Generated with Claude Code

@darreneid
darreneid changed the base branch from main to staging July 28, 2026 16:38
Zero-dependency Node script (test/staging/run.mjs) that exercises the
status-history feature against a live Discourse instance over the HTTP API,
verifying both the topic custom_fields state machine and the recorded
TopicStatusChange rows (read back via Data Explorer). See test/staging/README.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@darreneid
darreneid force-pushed the staging-test-suite branch from 4b3bb52 to 00ca01e Compare July 28, 2026 16:48
@darreneid
darreneid merged commit 1bf299f into staging Jul 28, 2026
5 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.

1 participant