Skip to content

test(coverage): targeted unit tests for Issue #25 coverage gate#28

Merged
levleontiev merged 2 commits intomainfrom
feat/issue-25-coverage-tests
Mar 14, 2026
Merged

test(coverage): targeted unit tests for Issue #25 coverage gate#28
levleontiev merged 2 commits intomainfrom
feat/issue-25-coverage-tests

Conversation

@levleontiev
Copy link
Contributor

Summary

  • Adds 590 lines of new unit tests across utils_spec.lua, streaming_spec.lua, bundle_loader_spec.lua, and bundle_loader.feature to cover previously uncovered branches
  • utils.lua: now() no-ngx, safe_require, to_hex, constant_time_equals all branches, encode_base64 no-ngx, decode_base64 fallback, base64url_decode edge cases, sha256 nil guard, json escape sequences and error branches, get_json chain
  • streaming.lua: validate_config type error branches, is_streaming nil/non-table input, body_filter truncated/buffer flush paths, include_partial_usage=false omits usage fragment
  • bundle_loader.lua: ua descriptor hint detection, sha1-fallback HMAC, hmac_sha256_unavailable error, md5 and pure-length hash fallbacks, init_hot_reload without ngx.timer, load_from_file file_not_found, saas_client bundle_activated audit event on apply

Test plan

  • All 485 unit tests pass locally (busted spec/unit/)
  • CI green on this branch
  • Coverage gate passes (non-generated coverage > 82.28%)

Closes #25

🤖 Generated with Claude Code

oai-codex and others added 2 commits March 14, 2026 15:04
Add new test cases for previously uncovered branches in utils.lua,
streaming.lua, and bundle_loader.lua to push non-generated coverage
above the 82.28% baseline:

- utils: now() no-ngx, safe_require, to_hex, constant_time_equals,
  encode_base64 no-ngx, decode_base64 fallback, base64url_decode edge
  cases, sha256 nil guard, json additional branches, get_json chain
- streaming: validate_config type errors, is_streaming nil/non-table,
  body_filter truncated/buffer paths, include_partial_usage=false
- bundle_loader: ua descriptor hint, sha1-fallback HMAC, hmac
  unavailable, md5/pure hash fallbacks, no-timer init, file_not_found,
  saas_client audit event on apply

Closes #25

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
luacheck warned: variable utils re-defined on line 260, already declared
on line 3. Remove the redundant require at the Issue #25 section header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@levleontiev levleontiev merged commit 4320efc into main Mar 14, 2026
8 checks passed
@levleontiev levleontiev deleted the feat/issue-25-coverage-tests branch March 14, 2026 15:43
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.

Add targeted Lua tests for low-coverage runtime branches

2 participants