test: add unit tests for mu-plugin, splash, and nginx-splash#15
Merged
Merged
Conversation
Cover three previously-untested pure library modules: - mu-plugin: theme auto-activation, signed-URL auto-login with constant-time secret comparison, injected LiveReload script tag, and configured/default port - splash: HTML document structure and key markers - nginx-splash: catch-all server config and splash try_files Tests only; no source changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raises coverage on previously-untested pure modules ahead of upcoming refactors.
What
Adds vitest unit tests for three pure
src/lib/modules that had notests/lib/counterpart:mu-plugin.ts— asserts the generated mu-plugin PHP includes theme auto-activation (byKIQR_THEME_SLUG, activate-once guard), signed-URL auto-login (hash_equalsconstant-time secret comparison, admin fallback, redirect + exit), and the injected LiveReload<script>tag with the configured port plus the35729default.splash.ts— asserts the splash HTML document structure and key markers (doctype, title, "No site is running" message,kiqr up/kiqr --helpinstructions, client-side hostname rendering, project link).nginx-splash.ts— asserts the catch-all nginx server config (listen 80,server_name _, html root,try_files /splash.html =404).Each suite also checks the file-write contract (returned path, directory creation) and output determinism, mirroring the existing
tests/lib/style.Risk
Tests only. No source changes — zero behavior risk.
Verification
npm run typecheck— passnpm test— 93 passed (17 files)npm run build— success🤖 Generated with Claude Code