Skip to content

test(ui-kit): packages/loopover-ui-kit has no test script, no vitest config, and no test files #7437

Description

@JSONbored

Context

packages/loopover-ui-kit (npm: @loopover/ui-kit) is the shared design-system package consumed by
both apps/loopover-ui (ORB) and apps/loopover-miner-ui (AMS). Its package.json has only two
scripts, build and typecheck — no test, and no test-related devDependencies at all. There is
no vitest.config.ts in the package directory, and no file anywhere under
packages/loopover-ui-kit/ matches *.test.*. The root vitest.config.ts's coverage.include list
enumerates src/**, packages/loopover-engine, packages/loopover-miner, packages/discovery-index,
and packages/loopover-mcp explicitly — packages/loopover-ui-kit is absent from that list too, so
even if a stray test file existed there today it would not be instrumented by the root run either.

In practice, whatever behavioral coverage this package's components get today happens only
indirectly, through whichever consuming app happens to re-export and exercise a given component or
hook (e.g. relativeTimeFromNow is thoroughly tested, but only via
apps/loopover-ui/src/components/site/refresh-meta.test.tsx importing it through the
apps/loopover-ui/src/lib/utils.ts re-export — not from any test inside the package that actually
owns the function). Some exports have no such indirect coverage found anywhere in this audit.
This repo already has a directly analogous precedent for treating an entirely-unmeasured directory as
a real bug worth its own issue: #6250 ("review-enrichment's real node:test coverage is invisible to
Codecov — 83 of 83 files effectively unmeasured"), filed and labeled gittensor:bug.

A concrete instance of what this blind spot costs: a re-render/edge-vs-level-trigger defect in
state-views.tsx (see the sibling issue on StateBoundary's failure-notify effect) slipped past
every existing indirect test, because none of them assert on the primitive's own contract directly.

Requirements

  • Add packages/loopover-ui-kit/vitest.config.ts (mirror apps/loopover-miner-ui/vitest.config.ts's
    shape: jsdom/happy-dom environment, React plugin, @testing-library/react setup) plus a test
    script in packages/loopover-ui-kit/package.json, and the needed test-only devDependencies
    (vitest, @testing-library/react, @testing-library/jest-dom or equivalent, a DOM environment
    package) — matching versions already used by apps/loopover-miner-ui's package.json where
    possible, to avoid introducing a second, drifting version of the same tooling in the monorepo.
  • Write real, colocated unit tests for the package's own logic-bearing exports only — not the
    ~40 purely-presentational shadcn-derived primitives (button.tsx, badge.tsx, card.tsx, etc.,
    which have no conditional logic of their own to regress). In scope:
    • src/utils.ts: cn (basic merge behavior) and relativeTimeFromNow (all four time buckets —
      seconds/minutes/hours/days — plus the future-clock-skew clamp to "just now"; note this function
      already has thorough indirect coverage via apps/loopover-ui/src/components/site/refresh-meta.test.tsx
      — port those exact cases into the new colocated test rather than inventing new ones, so behavior
      doesn't drift between the two).
    • src/hooks/use-mobile.tsx: useIsMobile — both above/below the 768px breakpoint, and a
      matchMedia change event flipping the result.
    • src/components/state-views.tsx: LoadingState/EmptyState/ErrorState default copy and the
      errorKind-driven network-vs-generic copy branch, and StateBoundary's
      loading/error/empty/children precedence order. Do not write a test asserting the current
      re-render-triggers-onFailureNotify-every-time behavior of the useEffect at lines 267–280 —
      that behavior is a known bug tracked separately; leave that specific effect's call-count behavior
      untested here to avoid locking in the bug, or coordinate with that issue if it's already in
      progress.
  • Wiring this new test script into the root test:ci orchestration path is out of scope for this
    issue
    unless there's an obvious single hook point — file that wiring as a follow-up if it turns
    out to need more than adding the package to an existing npm run fan-out list. State plainly in the
    PR if npm run test:ci at the root does or doesn't pick up the new suite.

Deliverables

  • packages/loopover-ui-kit/package.json has a test script and the test devDependencies.
  • packages/loopover-ui-kit/vitest.config.ts exists and runs standalone
    (npm --workspace @loopover/ui-kit run test or equivalent).
  • Colocated test files for utils.ts, hooks/use-mobile.tsx, and components/state-views.tsx
    (excluding the failure-notify effect's call-count behavior, per above).

Test Coverage Requirements

packages/loopover-ui-kit is not in the root vitest.config.ts's coverage.include list and is not
measured by Codecov's patch gate — similar in effect to the apps/** ignore in codecov.yml,
though not literally named there (it's simply never instrumented). This PR's acceptance signal is
that the new package-local test script runs and passes locally, not a Codecov percentage. Do not
attempt to force this package into the root coverage measurement as part of this issue — that's a
separate, larger decision (whether packages/loopover-ui-kit should ever be Codecov-gated at all)
that stays out of scope here.

Expected Outcome

packages/loopover-ui-kit's own logic (relativeTimeFromNow, useIsMobile, the state-primitive copy
branches) is verified directly, by a test suite that runs independently of any consuming app, instead
of only incidentally through whichever app happens to import and exercise it today.

Links & Resources

  • packages/loopover-ui-kit/package.json
  • apps/loopover-miner-ui/vitest.config.ts (the config shape to mirror)
  • apps/loopover-ui/src/components/site/refresh-meta.test.tsx (existing relativeTimeFromNow cases to port)
  • Precedent issue: #6250 (whole-directory coverage blind spot, same gittensor:bug shape)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions