Skip to content

test(dashboard): cover environment parsing and subdomain editing - #243

Merged
Hydralerne merged 6 commits into
oblien:feat/bugfix-batch-2026-09-16from
walidozich:chore/dashboard-test-infrastructure
Sep 16, 2026
Merged

Hydralerne merged 6 commits into
oblien:feat/bugfix-batch-2026-09-16from
walidozich:chore/dashboard-test-infrastructure

Conversation

@walidozich

@walidozich walidozich commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Adds 23 dashboard cases for pasted environment files and subdomain normalization, including quoted values, inline comments, CRLF, empty values, and preserving the hyphen a user is typing. CONTRIBUTING.md documents the workspace test conventions and local component cleanup.

Validation: 68 tests pass across the new suites and existing project-status and log-entry suites. Uses the dashboard’s existing Vitest configuration.

Related to #216. Integrates into the bug-review branch in #892; the contributor’s original commits are preserved.

Copilot AI review requested due to automatic review settings July 26, 2026 17:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds Vitest-based testing infrastructure to apps/dashboard, enabling .tsx component tests (via a jsdom project) while keeping existing logic tests on Node, and introduces initial unit test suites for several previously-untested modules. Also extends CONTRIBUTING.md with guidance on the new dashboard test setup and workflow.

Changes:

  • Add apps/dashboard/vitest.config.ts with @/* runtime aliasing, JSX transform override, and a split Node/jsdom project setup.
  • Add apps/dashboard/vitest.setup.ts to register jest-dom matchers and ensure React Testing Library cleanup runs with globals: false.
  • Add new unit test suites for dotenv parsing, subdomain normalization, project status derivation, and deployment phase detection; update dashboard devDependencies accordingly.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
CONTRIBUTING.md Documents test layout and the dashboard’s split Vitest project approach.
bun.lock Adds the new dashboard devDependencies (including jsdom/testing-library) and resulting lock updates.
apps/dashboard/package.json Adds Vitest DOM/component testing devDependencies.
apps/dashboard/vitest.config.ts Introduces Vitest config (alias + JSX override) and splits tests into Node vs jsdom projects by extension.
apps/dashboard/vitest.setup.ts Adds jest-dom integration and explicit RTL cleanup after each test.
apps/dashboard/src/lib/dotenv.test.ts Adds unit coverage for dotenv parsing behavior.
apps/dashboard/src/utils/deploymentPhaseDetector.test.ts Adds extensive unit coverage for phase detection and log parsing/aggregation behavior.
apps/dashboard/src/utils/project-status.test.ts Adds unit coverage for status precedence + label/meta utilities.
apps/dashboard/src/utils/subdomain.test.ts Adds unit coverage for subdomain normalization behaviors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread CONTRIBUTING.md Outdated
Comment on lines +169 to +170
Tests are colocated with the code they cover: `foo.test.ts` sits next to `foo.ts`. Every
workspace uses [Vitest](https://vitest.dev/).
expect(normalizeSubdomain("café")).toBe("caf");
});

it("strips leading and trailing hyphens, unlike normalizeSubdomandInput", () => {
Comment on lines +141 to +144
// Exhaustiveness guard: every ProjectStatus value must have non-empty
// styling, so adding a new status without wiring up its badge/dot fails
// this test loudly instead of silently rendering blank CSS classes.
const allStatuses: ProjectStatus[] = [
@walidozich

Copy link
Copy Markdown
Contributor Author

Thanks, all three were correct. Addressed in 07c7dc2.

1. CONTRIBUTING.md wording was inaccurate. Verified both counts: non-colocated tests do exist (packages/adapters/test/, apps/cli/test/), and apps/email/server/test/from-header.test.ts does import from bun:test. Reworded to say most workspaces use Vitest and most colocate, called out the test/ directory convention and the Bun runner by name, and scoped the rest of the section explicitly to apps/dashboard.

2. Typo fixed. normalizeSubdomandInput to normalizeSubdomainInput.

3. The "exhaustiveness guard" comment overclaimed. You were right that a manual array silently drifts. Rather than soften the wording, I made the guard real by keying it as a Record<ProjectStatus, true>:

const STATUS_COVERAGE: Record<ProjectStatus, true> = { live: true, /* ... */ draft: true };
const allStatuses = Object.keys(STATUS_COVERAGE) as ProjectStatus[];

Verified it actually fails now by temporarily adding "archived" to the ProjectStatus union:

apps/dashboard/src/utils/project-status.test.ts(150,9): error TS2741:
  Property 'archived' is missing in type '{ live: true; ... draft: true; }'
  but required in type 'Record<ProjectStatus, true>'.

So adding a status without covering it now breaks tsc --noEmit. Union reverted afterwards; suite is back to 8 files / 116 tests passing.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.

@Hydralerne Hydralerne changed the title test(dashboard): add Vitest infrastructure and first test suites test(dashboard): cover environment parsing and subdomain editing Sep 16, 2026
@Hydralerne
Hydralerne changed the base branch from main to feat/bugfix-batch-2026-09-16 September 16, 2026 06:26
@Hydralerne
Hydralerne merged commit 508adde into oblien:feat/bugfix-batch-2026-09-16 Sep 16, 2026
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.

3 participants