Skip to content

tests: add some tests for the webapp#368

Merged
henryiii merged 4 commits into
mainfrom
henryiii/chore/webapptests
Apr 14, 2026
Merged

tests: add some tests for the webapp#368
henryiii merged 4 commits into
mainfrom
henryiii/chore/webapptests

Conversation

@henryiii

@henryiii henryiii commented Apr 6, 2026

Copy link
Copy Markdown
Collaborator

Adding some tests, vscode + copilot.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds initial Bun-based unit/component tests for the TypeScript webapp and wires them into the repository’s CI workflow, with a small refactor to make URL-related helpers independently testable.

Changes:

  • Introduces Bun test suites for URL utilities, GitHub API ref fetching, and IfUrlLink rendering.
  • Extracts URL parsing/sanitization helpers into a dedicated module and updates the app to use it.
  • Adds test-oriented TypeScript config and updates CI/scripts to run bun test.

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tsconfig.test.json New TS config intended for type-checking test files with Bun types.
tsconfig.json Excludes *.test.ts/tsx from the main TS compilation.
src/repo-review-app/utils/url.ts New shared helpers for packageDir sanitization + refType parsing.
src/repo-review-app/utils/url.test.ts Unit tests for the new URL helpers.
src/repo-review-app/utils/github.ts Adds explicit JSON typing for GitHub refs responses.
src/repo-review-app/utils/github.test.ts Unit tests for fetchRepoRefs using a mocked fetch.
src/repo-review-app/repo-review-app.tsx Uses extracted URL helpers instead of inline functions.
src/repo-review-app/components/IfUrlLink.test.tsx Component-level rendering tests via renderToStaticMarkup.
package.json Adds test and type:test scripts; adds @types/bun.
bun.lock Lockfile updates for Bun/Node typing dependencies.
.github/workflows/ci.yml Runs Bun tests in CI.
Comments suppressed due to low confidence (1)

src/repo-review-app/utils/github.ts:25

  • branches/tags are already parsed as Array<{ name: string }> but the subsequent map still uses (branch: any) / (tag: any). This defeats the purpose of the cast and can hide JSON-shape regressions. Use the inferred element type (or define a RefJson type) and drop the any annotations in the map callbacks.
    const branches = (await branchesResponse.json()) as Array<{
      name: string;
    }>;
    const tags = (await tagsResponse.json()) as Array<{ name: string }>;

    return {
      branches: branches.map((branch: any) => ({
        name: branch.name,
        type: "branch",
      })),
      tags: tags.map((tag: any) => ({ name: tag.name, type: "tag" })),
    };

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

Comment thread src/repo-review-app/utils/github.test.ts
Comment thread .github/workflows/ci.yml
henryiii and others added 2 commits April 14, 2026 15:26
Assisted-by: OpenCode:Kimi-K2.5
Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii force-pushed the henryiii/chore/webapptests branch from e7aabaa to f2f4fe1 Compare April 14, 2026 19:49
@henryiii henryiii merged commit 5d9fcb5 into main Apr 14, 2026
13 checks passed
@henryiii henryiii deleted the henryiii/chore/webapptests branch April 14, 2026 20:07
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