Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add more unit tests and component tests#1289

Merged
Fermionic-Lyu merged 4 commits into
mainfrom
add-more-unit-component-tests
May 17, 2026
Merged

Add more unit tests and component tests#1289
Fermionic-Lyu merged 4 commits into
mainfrom
add-more-unit-component-tests

Conversation

@Fermionic-Lyu
Copy link
Copy Markdown
Member

@Fermionic-Lyu Fermionic-Lyu commented May 17, 2026

Summary

Add more tests


Summary by cubic

Add unit and component tests across the dashboard and @insforge/ui to improve coverage for analytics, helpers, dialogs, storage, realtime channels, core utils, and UI components. Split vitest configs per package and update CI to run separate UI tests and gate dashboard E2E on all test jobs.

  • Refactors

    • Split vitest into named projects for dashboard and @insforge/ui: unit uses node; component uses jsdom with package-local src/test/setup.ts.
    • Moved jsdom env and setupFiles out of shared configs into component configs; added project names.
    • Added @insforge/ui test scripts and excluded tests from build; CI runs ui-unit-tests and ui-component-tests, and gates dashboard-e2e-tests on all unit/component jobs.
  • Dependencies

    • @insforge/ui dev deps: vitest, jsdom, @testing-library/react, @testing-library/user-event.

Written for commit 6eb6460. Summary will update on new commits. Review in cubic

Note

Add unit and component tests for dashboard features and split vitest configs by environment

  • Adds test suites across analytics formatting helpers, database helpers, utility functions, and several dialog components (DeleteServiceDialog, CreateBackupDialog, RenameBackupDialog, BucketFormDialog, S3AccessKeyCreateDialog, ChannelFormDialog).
  • Moves jsdom environment and setupFiles config out of vitest.shared.config.ts into individual config files, setting unit tests to node environment and component/general tests to jsdom.
  • Behavioral Change: unit tests now run in a pure Node environment rather than jsdom; any unit test relying on browser globals will fail.

Changes since #1289 opened

  • Restructured the vitest configuration to use a projects-based approach [b0f1e94]
  • Added name fields to vitest unit and component test configurations [b0f1e94]
  • Updated test assertions for time and date formatting utilities to use exact string matching [b0f1e94]
  • Added test infrastructure with vitest, @testing-library/react, @testing-library/user-event, and jsdom as devDependencies to the @insforge/ui package, configured separate vitest.unit.config.ts and vitest.component.config.ts projects using node and jsdom environments respectively, created test setup running cleanup() via afterEach hook, added test, test:unit, and test:component npm scripts, excluded test files from build via tsconfig.build.json, and integrated ui-unit-tests and ui-component-tests jobs into GitHub Actions workflow running workspace-scoped vitest commands on ubuntu-latest with Node.js v20 [416986c]
  • Added component tests for Button component verifying native attribute forwarding including type, disabled, and className, class application based on variant and size props, and asChild prop rendering child anchor elements with expected role, href, and classes [416986c]
  • Added component tests for Input component asserting placeholder attribute passthrough, value updates and onChange handler invocation per keystroke during typing, disabled state support, and custom className application [416986c]
  • Added component tests for SearchInput component covering immediate and committed change callbacks when debounceTime equals zero, and clear button functionality that resets input value and invokes callbacks with empty string [416986c]
  • Added unit test for cn utility function validating conditional class merging and Tailwind CSS conflict resolution, expecting output text-sm px-4 from mixed input classes [416986c]
  • Renamed dashboard E2E tests job in CI workflow and added job dependencies [6eb6460]
  • Created shared Vitest configuration with package alias resolution [6eb6460]
  • Updated test file imports to use package alias [6eb6460]
  • Added test case for partial field updates in ChannelFormDialog [6eb6460]

Macroscope summarized 6ed78f2.

Summary by CodeRabbit

  • Tests

    • Added broad Vitest + React Testing Library coverage for analytics formatting, database helpers, function headers, realtime channels, storage dialogs/flows, backup dialogs, delete/rename dialogs, S3 access key flow, UI components (Button, Input, SearchInput), utilities, and centralized test setup/cleanup.
  • Chores

    • Split test configs into explicit unit/component projects, added test scripts and dev-dependencies, excluded test files from builds, and updated CI to run separate unit and component UI test jobs before E2E.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 17, 2026

Walkthrough

Adds many Vitest test suites for dashboard and ui packages, splits Vitest configs into unit (node) and component (jsdom) projects with package-level setup, updates ui package test scripts/deps/tsconfig, and adds CI jobs to run UI unit/component tests before dashboard E2E.

Changes

Test infrastructure and CI

Layer / File(s) Summary
Vitest configuration environment split
packages/dashboard/vitest.shared.config.ts, packages/dashboard/vitest.unit.config.ts, packages/dashboard/vitest.component.config.ts, packages/dashboard/vitest.config.ts, packages/ui/vitest.shared.config.ts, packages/ui/vitest.unit.config.ts, packages/ui/vitest.component.config.ts, packages/ui/vitest.config.ts, packages/ui/package.json, packages/ui/tsconfig.build.json, packages/ui/src/test/setup.ts
Shared config removed the test block; dashboard unit config sets node; dashboard component config sets jsdom + setupFiles; top-level dashboard vitest references project configs; UI package gains unit/component configs, test scripts, setup, and test devDependencies/tsconfig exclusions.
CI: frontend UI test jobs
.github/workflows/frontend-tests.yml
Adds ui-unit-tests and ui-component-tests GitHub Actions jobs that run the @insforge/ui workspace unit and component Vitest suites and makes the dashboard E2E job depend on them.

Feature test coverage

Layer / File(s) Summary
Dialog & component interaction tests
packages/dashboard/src/features/compute/components/__tests__/DeleteServiceDialog.test.tsx, packages/dashboard/src/features/database/components/__tests__/CreateBackupDialog.test.tsx, packages/dashboard/src/features/database/components/__tests__/RenameBackupDialog.test.tsx, packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx, packages/dashboard/src/features/storage/components/__tests__/BucketFormDialog.test.tsx, packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx
Dialog tests verify user input flows, confirmation gating, trimming/normalization, toggle/enable behavior, and that callbacks (onCreate/onSave/onConfirm/onOpenChange) are invoked with expected values.
Helper and utility function tests
packages/dashboard/src/features/analytics/lib/__tests__/format.test.ts, packages/dashboard/src/features/database/__tests__/helpers.test.ts, packages/dashboard/src/features/functions/__tests__/helpers.test.ts, packages/dashboard/src/lib/utils/__tests__/utils.test.ts, packages/ui/src/components/__tests__/*, packages/ui/src/lib/__tests__/utils.test.ts
Tests for analytics formatting, database schema/column helpers, header normalization, and dashboard/ui utilities (class merging, version comparison, timestamp/date formatting, value conversion), including null/invalid-input paths and UI component behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • InsForge/InsForge#1284: Both PRs configure the dashboard Vitest testing infrastructure (vitest.*.config.ts files and src/test/setup.ts) to establish jsdom and setup file patterns as part of test-suite expansion.

Suggested reviewers

  • jwfing
  • Leo-rq-yu

Poem

🐰
I hopped through tests with ears so keen,
jsdom and node now split the scene.
Dialogs trimmed and helpers true,
Assertions passed — a carrot brew.
Hop, tests, hop — the green build gleams!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main changes: multiple unit and component tests are added across the dashboard and UI packages, and Vitest configurations are refactored to organize tests into named projects.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-more-unit-component-tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Member

@jwfing jwfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — Add more unit tests and component tests

Summary: Good coverage addition across analytics, compute, database, functions, realtime, storage, and core utils. The vitest config refactor (splitting environment per config type) is a clean improvement. No blocking issues found.


Requirements context

No spec or plan under /docs/superpowers/ matches this PR's scope (pure test coverage improvement with a config refactor). Assessed against the PR description alone: add unit/component tests across the dashboard and align vitest environments per config type.


Findings

Critical

(none)


Suggestion

[Software Engineering] vitest.config.ts still runs unit .ts tests under jsdom

packages/dashboard/vitest.config.ts:9

The default config includes src/**/*.test.{ts,tsx} with environment: 'jsdom'. This is a superset of both the unit config (.tsnode) and the component config (.tsxjsdom). As a result, running vitest without an explicit --config flag still executes all unit tests (.ts) in jsdom rather than node. The environment improvement only applies when callers explicitly use vitest.unit.config.ts. Consider noting this in the PR or a follow-up comment/script, or accepting the default config as a "run-everything-in-jsdom" convenience while specialized configs enforce stricter environments in CI.


[Functionality] BucketFormDialog.test.tsx — only create mode tested

packages/dashboard/src/features/storage/components/__tests__/BucketFormDialog.test.tsx:26–47

The mock exposes editBucket but no test exercises the edit mode. A follow-up test would verify that submitting in edit mode calls editBucket (not createBucket) with the updated name.


[Functionality] ChannelFormDialog.test.tsx — only happy-path create tested

packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx:7–25

No coverage for: submitting with an empty/invalid pattern (validation rejection), or the edit flow if the component supports it. These would be valuable to add alongside the existing test.


[Functionality] DeleteServiceDialog.test.tsx — error path not covered

packages/dashboard/src/features/compute/components/__tests__/DeleteServiceDialog.test.tsx:7–33

The test exercises the full success path. Worth adding a case where onConfirm rejects — verify the dialog stays open and an error state (if any) is displayed, so that regression protection exists if error handling is changed later.


Information

[Software Engineering] Prefer jest-dom matchers for disabled assertions

packages/dashboard/src/features/compute/components/__tests__/DeleteServiceDialog.test.tsx:21,24
packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx:47,51

// current
expect((deleteButton as HTMLButtonElement).disabled).toBe(true);

// preferred — setup.ts already imports @testing-library/jest-dom/vitest
expect(deleteButton).toBeDisabled();
expect(doneButton).not.toBeDisabled();

toBeDisabled() gives a clearer failure message and avoids the as HTMLButtonElement cast.


[Software Engineering] Redundant .toBeTruthy() on getBy* queries

packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx:41–42

expect(screen.getByText('S3 Access Key Created')).toBeTruthy();
expect(screen.getByDisplayValue(createdKey.accessKeyId)).toBeTruthy();

getBy* queries throw if the element is not found, so .toBeTruthy() is redundant. Prefer toBeInTheDocument() from jest-dom (already available via setup.ts) for a more descriptive failure message, or omit the expect wrapper entirely and rely on the query throw.


Verdict

approved (informational — no Critical findings; a human must give the explicit GitHub approval)

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx (1)

17-24: ⚡ Quick win

Consider asserting dialog closing for consistency.

The other dialog tests in this PR (DeleteServiceDialog, CreateBackupDialog, RenameBackupDialog) all verify that onOpenChange(false) is called after the action completes. Adding the same assertion here would maintain consistency and ensure the dialog closes properly after channel creation.

Suggested addition
 await waitFor(() => {
   expect(onCreate).toHaveBeenCalledWith({
     pattern: 'room:%',
     enabled: true,
     description: 'Room updates',
     webhookUrls: undefined,
   });
+  expect(onOpenChange).toHaveBeenCalledWith(false);
 });

To support this assertion, capture the mock at line 11:

-render(<ChannelFormDialog mode="create" open onOpenChange={vi.fn()} onCreate={onCreate} />);
+const onOpenChange = vi.fn();
+render(<ChannelFormDialog mode="create" open onOpenChange={onOpenChange} onCreate={onCreate} />);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx`
around lines 17 - 24, The test should also assert the dialog is closed by
verifying onOpenChange(false) is called; add a jest mock for onOpenChange (e.g.,
const onOpenChange = jest.fn()) and pass it into the rendered ChannelFormDialog
in the test, then extend the existing waitFor block that checks onCreate to also
expect(onOpenChange).toHaveBeenCalledWith(false). Ensure you place the
onOpenChange mock alongside the existing onCreate mock so the test verifies both
channel creation (onCreate) and dialog closing (onOpenChange(false)).
packages/dashboard/src/lib/utils/__tests__/utils.test.ts (1)

37-42: ⚡ Quick win

Strengthen the formatTime assertion to verify time component.

The test at line 39 uses toMatch(/May 17, 2026/) which only verifies the date portion. Since the function is named formatTime (not formatDate), the assertion should verify that time information is included in the output.

🧪 Proposed enhancement to verify time component
-    expect(formatTime('2026-05-17T12:30:00.000Z')).toMatch(/May 17, 2026/);
+    expect(formatTime('2026-05-17T12:30:00.000Z')).toMatch(/May 17, 2026.*12:30/);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/dashboard/src/lib/utils/__tests__/utils.test.ts` around lines 37 -
42, The test for formatTime only checks the date portion; update the assertion
for formatTime('2026-05-17T12:30:00.000Z') to also verify the time component is
present (e.g. assert the output contains "12:30" or matches a time regex like
/,\s*\d{1,2}:\d{2}/ or a locale time pattern) while keeping the invalid-input
check unchanged; locate the test in the describe('formatTime') block and modify
the expect for formatTime accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/dashboard/vitest.config.ts`:
- Around line 9-11: The root vitest config currently sets environment: 'jsdom'
and include: ['src/**/*.test.{ts,tsx}'] (with setupFiles) which causes unit and
component tests to run in jsdom; update this file to stop mixing environments by
either removing the test configuration entirely so vitest.unit.config.ts and
vitest.component.config.ts are used exclusively, or change the include pattern
to only component tests (e.g., include only *.test.tsx) and keep environment:
'jsdom' and setupFiles only for component runs; locate the keys environment,
include and setupFiles in vitest.config.ts to apply the change.

---

Nitpick comments:
In
`@packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx`:
- Around line 17-24: The test should also assert the dialog is closed by
verifying onOpenChange(false) is called; add a jest mock for onOpenChange (e.g.,
const onOpenChange = jest.fn()) and pass it into the rendered ChannelFormDialog
in the test, then extend the existing waitFor block that checks onCreate to also
expect(onOpenChange).toHaveBeenCalledWith(false). Ensure you place the
onOpenChange mock alongside the existing onCreate mock so the test verifies both
channel creation (onCreate) and dialog closing (onOpenChange(false)).

In `@packages/dashboard/src/lib/utils/__tests__/utils.test.ts`:
- Around line 37-42: The test for formatTime only checks the date portion;
update the assertion for formatTime('2026-05-17T12:30:00.000Z') to also verify
the time component is present (e.g. assert the output contains "12:30" or
matches a time regex like /,\s*\d{1,2}:\d{2}/ or a locale time pattern) while
keeping the invalid-input check unchanged; locate the test in the
describe('formatTime') block and modify the expect for formatTime accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eab99413-1bcc-4034-b1dc-2f5e40166e86

📥 Commits

Reviewing files that changed from the base of the PR and between 15d7c6c and 6ed78f2.

📒 Files selected for processing (14)
  • packages/dashboard/src/features/analytics/lib/__tests__/format.test.ts
  • packages/dashboard/src/features/compute/components/__tests__/DeleteServiceDialog.test.tsx
  • packages/dashboard/src/features/database/__tests__/helpers.test.ts
  • packages/dashboard/src/features/database/components/__tests__/CreateBackupDialog.test.tsx
  • packages/dashboard/src/features/database/components/__tests__/RenameBackupDialog.test.tsx
  • packages/dashboard/src/features/functions/__tests__/helpers.test.ts
  • packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx
  • packages/dashboard/src/features/storage/components/__tests__/BucketFormDialog.test.tsx
  • packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx
  • packages/dashboard/src/lib/utils/__tests__/utils.test.ts
  • packages/dashboard/vitest.component.config.ts
  • packages/dashboard/vitest.config.ts
  • packages/dashboard/vitest.shared.config.ts
  • packages/dashboard/vitest.unit.config.ts
💤 Files with no reviewable changes (1)
  • packages/dashboard/vitest.shared.config.ts

Comment thread packages/dashboard/vitest.config.ts Outdated
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 14 files

Confidence score: 4/5

  • This PR looks safe to merge overall, with only a minor-to-moderate risk centered on test reliability rather than production behavior.
  • The main issue is in packages/dashboard/src/lib/utils/__tests__/utils.test.ts: formatting a ...Z timestamp in local time can shift the calendar day, which may cause flaky failures across different timezones/CI environments.
  • Given the 4/10 severity and the issue being test-only, risk to end users appears limited, but merge confidence is slightly reduced due to potential intermittent CI instability.
  • Pay close attention to packages/dashboard/src/lib/utils/__tests__/utils.test.ts - timezone-dependent date expectations may fail unpredictably across environments.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/dashboard/src/lib/utils/__tests__/utils.test.ts">

<violation number="1" location="packages/dashboard/src/lib/utils/__tests__/utils.test.ts:39">
P2: This test is timezone-dependent: a `...Z` timestamp formatted in local time can produce a different calendar day, causing flaky failures across environments.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Re-trigger cubic

Comment thread packages/dashboard/src/lib/utils/__tests__/utils.test.ts Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 17, 2026

Greptile Summary

This PR adds unit and component test suites across the dashboard and @insforge/ui packages, and restructures vitest into per-environment projects (node for unit, jsdom for component) so each suite runs with the correct globals.

  • Vitest configs for both packages are split into named unit and component projects; the combined vitest.config.ts delegates to them via projects, fixing the previous environment mismatch for npm test.
  • New tests cover analytics formatting helpers, database helpers, functions header normalisation, several dialog components (DeleteServiceDialog, CreateBackupDialog, RenameBackupDialog, BucketFormDialog, S3AccessKeyCreateDialog, ChannelFormDialog), and core UI components (Button, Input, SearchInput, cn).
  • CI is updated with dedicated ui-unit-tests and ui-component-tests jobs; the E2E job is renamed dashboard-e2e-tests and now gates on all four preceding jobs.

Confidence Score: 5/5

Safe to merge — changes are additive test infrastructure with no modifications to production code paths.

All changes are test files, vitest config restructuring, a tsconfig build exclusion, and CI workflow additions. Production source files are untouched. The vitest project split correctly assigns environments, and the date/locale assertions in the new tests are stable because they use date-fns English formatting rather than system locale.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/frontend-tests.yml Adds ui-unit-tests and ui-component-tests CI jobs; renames old E2E job to dashboard-e2e-tests and gates it on all four preceding jobs.
packages/dashboard/vitest.config.ts Refactored to use vitest projects so both unit (node) and component (jsdom) suites run under the correct environment when npm test is invoked.
packages/dashboard/vitest.shared.config.ts Removed the global environment: jsdom and setupFiles from shared config; each project now declares its own environment.
packages/ui/vitest.shared.config.ts New shared config for the UI package; provides the @insforge/ui path alias pointing to src/index.ts.
packages/ui/src/test/setup.ts Minimal test setup — registers an afterEach cleanup hook; consistent with the UI tests only using raw DOM property checks.
packages/dashboard/src/features/realtime/components/tests/ChannelFormDialog.test.tsx Well-structured tests for create/edit flows; redundant .toBeTruthy() assertions on getByDisplayValue results do not add value (see comment).
packages/dashboard/src/features/analytics/lib/tests/format.test.ts Uses vi.useFakeTimers correctly to pin Date.now() for formatRelativeTime; all formatting helpers use explicit date-fns or en-US locale so assertions are locale-independent.
packages/ui/src/components/tests/SearchInput.test.tsx Clear-button test is valid — SearchInput uses internal state so handleClear sets internalValue to empty string independently of the controlled value prop.
packages/dashboard/src/lib/utils/tests/utils.test.ts Format assertions (formatTime, formatDate) are locale-safe because they rely on date-fns English formatting, not the system Intl locale.
packages/ui/tsconfig.build.json Correctly excludes test files and the setup directory from the production build output.

Reviews (4): Last reviewed commit: "address comments" | Re-trigger Greptile

Comment thread packages/dashboard/vitest.config.ts Outdated
@Fermionic-Lyu Fermionic-Lyu enabled auto-merge May 17, 2026 21:08
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/frontend-tests.yml (1)

52-90: ⚡ Quick win

Gate dashboard UI tests on the new unit/component jobs for fail-fast CI.

Right now all jobs can run concurrently. Adding needs to dashboard-ui-tests ensures the heavier Playwright job only starts after fast UI suites pass.

Workflow tweak
   dashboard-ui-tests:
     name: Dashboard UI Tests
     runs-on: ubuntu-latest
+    needs:
+      - dashboard-unit-tests
+      - dashboard-component-tests
+      - ui-unit-tests
+      - ui-component-tests
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/frontend-tests.yml around lines 52 - 90, The dashboard
Playwright job currently can run in parallel with the new UI jobs; update the
GitHub Actions workflow so the dashboard Playwright job (dashboard-ui-tests)
depends on the fast UI jobs by adding a needs: entry referencing the new job ids
(ui-unit-tests and ui-component-tests) so dashboard-ui-tests only starts after
those pass; modify the dashboard-ui-tests job definition to include needs:
[ui-unit-tests, ui-component-tests].
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/frontend-tests.yml:
- Around line 52-90: The dashboard Playwright job currently can run in parallel
with the new UI jobs; update the GitHub Actions workflow so the dashboard
Playwright job (dashboard-ui-tests) depends on the fast UI jobs by adding a
needs: entry referencing the new job ids (ui-unit-tests and ui-component-tests)
so dashboard-ui-tests only starts after those pass; modify the
dashboard-ui-tests job definition to include needs: [ui-unit-tests,
ui-component-tests].

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 981f0f5f-89c8-42c7-8df1-34923317c5a6

📥 Commits

Reviewing files that changed from the base of the PR and between b0f1e94 and 416986c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • .github/workflows/frontend-tests.yml
  • packages/ui/package.json
  • packages/ui/src/components/__tests__/Button.test.tsx
  • packages/ui/src/components/__tests__/Input.test.tsx
  • packages/ui/src/components/__tests__/SearchInput.test.tsx
  • packages/ui/src/lib/__tests__/utils.test.ts
  • packages/ui/src/test/setup.ts
  • packages/ui/tsconfig.build.json
  • packages/ui/vitest.component.config.ts
  • packages/ui/vitest.config.ts
  • packages/ui/vitest.unit.config.ts
✅ Files skipped from review due to trivial changes (5)
  • packages/ui/src/test/setup.ts
  • packages/ui/vitest.component.config.ts
  • packages/ui/vitest.config.ts
  • packages/ui/vitest.unit.config.ts
  • packages/ui/src/lib/tests/utils.test.ts

Copy link
Copy Markdown
Member

@jwfing jwfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Solid test-coverage expansion across analytics, database, storage, compute, realtime, and @insforge/ui primitives, with a well-executed vitest config split into node/jsdom project environments.

Requirements context

No matching spec/plan found under /docs/superpowers/ — this is a standalone test-addition initiative. Assessment is against the PR description and the implicit requirement of "increase coverage without breaking existing behaviour."


Findings

Critical

(none)


Suggestion

Software engineering — missing edit-mode coverage for ChannelFormDialog
packages/dashboard/src/features/realtime/components/__tests__/ChannelFormDialog.test.tsx:1-26

The component accepts both mode="create" and mode="edit". In edit mode the form is pre-populated from the channel prop, the submit button label changes to "Save Channel", and the callback interface is different (onEdit vs onCreate). Only create mode is tested. The edit path has distinct logic (diff webhook comparison at ChannelFormDialog.tsx:133-139) that would benefit from at least one test.

Software engineering — @insforge/ui vitest configs have no shared base
packages/ui/vitest.component.config.ts, packages/ui/vitest.unit.config.ts

Unlike the dashboard package (which uses mergeConfig(sharedConfig, ...) to share path aliases and other settings), the UI configs are fully standalone. Right now this is fine because tests only use relative imports. But if path aliases or global test options are ever needed, both files must be updated independently with no shared source. Consider extracting a vitest.shared.config.ts following the dashboard's pattern to avoid future divergence.


Information

Software engineering — direct .disabled property access instead of jest-dom matchers
packages/dashboard/src/features/compute/components/__tests__/DeleteServiceDialog.test.tsx:21, packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx:45

// current
expect((deleteButton as HTMLButtonElement).disabled).toBe(true);

// clearer with @testing-library/jest-dom
expect(deleteButton).toBeDisabled();

@testing-library/jest-dom is a common companion library that provides DOM-aware matchers with better failure messages. If the project chooses to add it, a one-line import in each setup file covers all tests. Not a blocker — the current assertions are functionally correct.

Software engineering — BucketFormDialog and S3AccessKeyCreateDialog cover only the happy path
packages/dashboard/src/features/storage/components/__tests__/BucketFormDialog.test.tsx, packages/dashboard/src/features/storage/components/__tests__/S3AccessKeyCreateDialog.test.tsx

Edit mode for BucketFormDialog and error/rejection paths for both dialogs are not covered. Fine for a first-pass PR; just noting so follow-up work is tracked.

Software engineering — @insforge/ui gets its own hoisted [email protected] install
packages/ui/package.json:78-85, package-lock.json

The lock file shows a nested packages/ui/node_modules/vitest block. If the workspace root already provides the same version of vitest to all packages, the package-level devDependency is redundant. Minor install-time overhead only; no functional issue.


Verdict

approved (informational — no Critical findings; explicit GitHub approval via the approve flow)

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 17, 2026

Want your agent to iterate on Greptile's feedback? Try greploops.

Copy link
Copy Markdown
Member

@jwfing jwfing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, approved.

@Fermionic-Lyu Fermionic-Lyu merged commit 33735d9 into main May 17, 2026
13 checks passed
@Fermionic-Lyu Fermionic-Lyu deleted the add-more-unit-component-tests branch May 17, 2026 22:01
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