mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-08 02:03:34 +08:00
test: add 3 edge-case tests for looksLikePath heuristic, falsy title coercion, and checkbox regex (Round 102)
- getSessionStats with Unix nonexistent .tmp path triggers looksLikePath heuristic → readFile returns null → zeroed stats via null content path - setAlias with title=0 silently converts to null (0 || null === null) - parseSessionMetadata skips [x] checked items in In Progress section (regex only matches unchecked [ ] checkboxes) Total tests: 866
This commit is contained in:
@@ -1310,6 +1310,23 @@ function runTests() {
|
||||
'Alias should no longer exist after removal');
|
||||
})) passed++; else failed++;
|
||||
|
||||
// ── Round 102: setAlias with title=0 (falsy number coercion) ──
|
||||
console.log('\nRound 102: setAlias (title=0 — falsy coercion silently converts to null):');
|
||||
if (test('setAlias with title=0 stores null (0 || null === null due to JavaScript falsy coercion)', () => {
|
||||
// session-aliases.js line 221: `title: title || null` — the value 0 is falsy
|
||||
// in JavaScript, so `0 || null` evaluates to `null`. This means numeric
|
||||
// titles like 0 are silently discarded.
|
||||
resetAliases();
|
||||
const result = aliases.setAlias('zero-title', '/sessions/test', 0);
|
||||
assert.strictEqual(result.success, true,
|
||||
'setAlias should succeed (0 is valid as a truthy check bypass)');
|
||||
assert.strictEqual(result.title, null,
|
||||
'Title should be null because 0 || null === null (falsy coercion)');
|
||||
const resolved = aliases.resolveAlias('zero-title');
|
||||
assert.strictEqual(resolved.title, null,
|
||||
'Persisted title should be null after round-trip through saveAliases/loadAliases');
|
||||
})) passed++; else failed++;
|
||||
|
||||
// Summary
|
||||
console.log(`\nResults: Passed: ${passed}, Failed: ${failed}`);
|
||||
process.exit(failed > 0 ? 1 : 0);
|
||||
|
||||
Reference in New Issue
Block a user