Skip to content

test: add unit tests for mu-plugin, splash, and nginx-splash#15

Merged
kjellberg merged 1 commit into
kiqr:mainfrom
kjellbergzoey:test/cover-pure-lib-modules
Jun 7, 2026
Merged

test: add unit tests for mu-plugin, splash, and nginx-splash#15
kjellberg merged 1 commit into
kiqr:mainfrom
kjellbergzoey:test/cover-pure-lib-modules

Conversation

@kjellbergzoey

Copy link
Copy Markdown
Contributor

Raises coverage on previously-untested pure modules ahead of upcoming refactors.

What

Adds vitest unit tests for three pure src/lib/ modules that had no tests/lib/ counterpart:

  • mu-plugin.ts — asserts the generated mu-plugin PHP includes theme auto-activation (by KIQR_THEME_SLUG, activate-once guard), signed-URL auto-login (hash_equals constant-time secret comparison, admin fallback, redirect + exit), and the injected LiveReload <script> tag with the configured port plus the 35729 default.
  • splash.ts — asserts the splash HTML document structure and key markers (doctype, title, "No site is running" message, kiqr up / kiqr --help instructions, 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 — pass
  • npm test — 93 passed (17 files)
  • npm run build — success

🤖 Generated with Claude Code

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>
@kjellberg
kjellberg merged commit cc1ebcb into kiqr:main Jun 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants