Skip to content

test: dedupe isDefined helper against the library util - #144

Merged
mbret merged 1 commit into
mainfrom
chore/consolidation-2026-07-20
Jul 24, 2026
Merged

test: dedupe isDefined helper against the library util#144
mbret merged 1 commit into
mainfrom
chore/consolidation-2026-07-20

Conversation

@mbret

@mbret mbret commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

src/tests/liveQuery.tsx defined its own isDefined type-guard:

export function isDefined<T>(value: T | undefined | null): value is T {
  return value != null
}

This is a runtime-identical copy of the shipped src/lib/utils/isDefined.ts. The two live-query test suites now import isDefined from the library util directly, and the local copy is deleted — one implementation instead of two.

Behavior-preserving: the query pipes and assertions are unchanged; only the source of isDefined moved.

Net LOC

2 insertions, 6 deletions → net −4 lines across 3 files.

Note

An earlier revision of this PR also extracted the repeated live-query queryFn pipe into a createLiveQueryFn factory in the shared test helper. That was reverted — a test-only closure factory living in the source tree wasn't a good trade, so the inline pipes are left as-is.

Gates

All green locally: biome check, tsc, vite build, vitest run (129 tests).

🤖 Generated with Claude Code

@mbret
mbret force-pushed the chore/consolidation-2026-07-20 branch from 675649b to 50bec0f Compare July 24, 2026 08:53
@mbret mbret changed the title test: consolidate duplicated live-query queryFn into a shared helper test: dedupe isDefined helper against the library util Jul 24, 2026
The live-query test helper (src/tests/liveQuery.tsx) defined its own
`isDefined` type-guard, a runtime-identical copy of the shipped
`src/lib/utils/isDefined.ts`. Import the library util directly in the
two live-query test suites and delete the local copy, so there is one
implementation instead of two.

Behavior-preserving: the query pipes and assertions are unchanged; only
the source of `isDefined` moved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PMgtP4GREPoEq9LdTBcHky
@mbret
mbret force-pushed the chore/consolidation-2026-07-20 branch from 50bec0f to 48eb210 Compare July 24, 2026 08:54
@mbret
mbret merged commit e54aa6f into main Jul 24, 2026
1 check passed
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.

2 participants