test: improve develop branch test coverage#54
Conversation
Rust (clawpal-core): 145 → 195 unit tests (+50) - ssh/config: 1→15 tests (multi-host, wildcards, quotes, comments, equals separator, dedup, case-insensitive keys, first-value-wins) - ssh/mod: 4→18 tests (legacy args, destination, port, identity file, resolve_target, shell_escape, error display, candidate_key_paths) - connect: 2→10 tests (slug_from_home, missing home errors, explicit instance ids, error display) - sessions: 4→14 tests (array content preview, multiple agents, empty input, sort order, filter edge cases) - cron: 2→10 tests (plain array, object map, empty/invalid input, ordering, preserves existing jobId) - watchdog: 1→8 tests (dead state, deployed flag, invalid json, empty/whitespace ps output) - openclaw: 4→10 tests (array extraction, nonzero exit, no json, nested json, error display) - backup: 3→9 tests (empty input, trailing slash, malformed lines, dedup versions) TypeScript (Bun): 10 → 58 tests (+48) - guidance.ts: 30 new tests (cooldown/transient/explained/registry/container error classifiers, throttle logic) - model-value.ts: 8 new tests (provider+model combining, prefix dedup, whitespace, edge cases) - utils.ts: 12 new tests (formatTime dash/ISO/RFC3339/invalid, formatBytes all units)
📊 Test Coverage Report
Coverage measured by |
bun:test in 1.3.x does not export beforeEach; it was imported but never used, causing typecheck to fail.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4f9079a40
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Should produce a valid date-time string | ||
| expect(result).toMatch(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/); | ||
| expect(result).toContain("2026"); | ||
| expect(result).toContain("14:30:00"); |
There was a problem hiding this comment.
Remove fixed local-time assertion from dash timestamp test
This check hard-codes 14:30:00, but formatTime converts the dash form through a UTC date (...Z) and then formats in the runner's local timezone, so non-UTC environments produce different clock times (for example, UTC+8 yields 22:30:00). That makes the test fail or become environment-dependent even when the implementation is correct; assert a timezone-agnostic property or derive the expected local time from the current TZ instead of pinning a fixed HH:MM:SS.
Useful? React with 👍 / 👎.
Rust (clawpal-core): 195 → 283 unit tests (+88) - config: 17→57 (+40) — all template patches, read_model_value, collect_change_paths, channel nodes, resolve_channel_mode/allowlist - discovery: 3→19 (+16) — accounts path, slug/name fallback, wildcards, dedup, bindings, numeric IDs, edge cases - health: 4→15 (+11) — count_agents, parse_active_agents, shell_escape, error display, missing SSH config - install/docker: 5→12 (+7) — needs_local_image_fallback variants, compose_env, openclaw_state_dir, tilde expansion - instance: 8→20 (+12) — sanitize_instance_id_segment, endpoint_key, canonical_remote_instance_id, normalize, ids, error display - precheck: 7→12 (+5) — empty profiles, valid registry, existing home, multiple profile check TypeScript (Bun): 58 → 69 tests (+11) - prompt-templates: 11 new (renderPromptTemplate + extractPromptBlock pure logic) Rust line coverage: 67.14% → ~73% (estimated from local llvm-cov)
Keith-CY
left a comment
There was a problem hiding this comment.
Review summary
Approved.
Scope checked
- All changes are test-only ( additions) across Rust and Bun test files.
- No production logic paths were modified in this PR.
Notes
- The new test cases materially expand coverage for parsing and config/instance/error helpers.
- I did not identify correctness, security, or reliability regressions in the added tests.
Summary
Two rounds of test coverage improvement for the
developbranch.Round 1: Rust 145→195 (+50) · TS 10→58 (+48)
Round 2: Rust 195→283 (+88) · TS 58→69 (+11)
Coverage delta (local llvm-cov)
No production code changes
All changes are test-only (
#[cfg(test)]blocks +__tests__/files).