tests: add some tests for the webapp#368
Merged
Merged
Conversation
0d7ce62 to
e7aabaa
Compare
Contributor
There was a problem hiding this comment.
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
IfUrlLinkrendering. - 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/tagsare already parsed asArray<{ name: string }>but the subsequentmapstill 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 aRefJsontype) and drop theanyannotations in themapcallbacks.
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.
Signed-off-by: Henry Schreiner <[email protected]>
Assisted-by: OpenCode:Kimi-K2.5 Signed-off-by: Henry Schreiner <[email protected]>
e7aabaa to
f2f4fe1
Compare
Co-authored-by: Copilot <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding some tests, vscode + copilot.