Skip to content

test(server): cover the local-flavor widget-serving routes#115

Merged
brentrager merged 1 commit into
mainfrom
test-widget-serving-routes
Jun 25, 2026
Merged

test(server): cover the local-flavor widget-serving routes#115
brentrager merged 1 commit into
mainfrom
test-widget-serving-routes

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

The local deployment flavor serves the Aurora Glass widget — the host page at `/` (auth token injected) and the `@smooai/chat-widget` bundle at `/chat-widget.iife.js` — but had no test. A re-vendor of that bundle (e.g. #113, which re-pointed it at `@smooai/[email protected]`) compiles via `include_str!` even if the served asset is broken or the wrong package.

Adds `tests/widget_serving.rs` (drives the real axum router via `tower::ServiceExt::oneshot`, no network):

  • `/chat-widget.iife.js` → 200, `application/javascript`, body carries the Aurora Glass markers: the `` element, the `SmoothAgentChat` global, and the inlined `send_message` protocol client.
  • `/` → 200, the `SMOOTH_LOCAL_TOKEN` placeholder is substituted with the JSON token + the widget element is mounted.
  • both routes → 404 unless the flavor opts in via `with_widget(...)` (K8s/Lambda never serve them).

3 tests, all green.

🤖 Generated with Claude Code

The local flavor serves the Aurora Glass widget (the host page at / with the
auth token injected, and the @smooai/chat-widget bundle at /chat-widget.iife.js)
but had NO test — a re-vendor (e.g. #113) can compile via include_str! yet serve
a broken/wrong bundle. Adds tests/widget_serving.rs (tower oneshot, no network):
the bundle is served with the right content-type + the Aurora Glass markers
(<smooth-agent-chat>, SmoothAgentChat global, inlined send_message client); the
host page substitutes the token placeholder + mounts the element; and both
routes are 404 unless the flavor opts in via with_widget (K8s/Lambda never serve
them). 3 tests, all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01U7Mn93HpqhSgEmX6tRdPAv
@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 03f1c8c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@brentrager brentrager merged commit b6d0903 into main Jun 25, 2026
1 check 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