CodeRabbit Generated Unit Tests: Add Generated Unit Tests for PR Changes - #44
Conversation
|
Important Review skippedThis PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note
|
Greptile SummaryThis PR adds unit tests generated by CodeRabbit: tests for the
Confidence Score: 4/5The desktop/main changes are safe to merge; the dependency-pinning test will fail on first run because libraries/base was not remediated alongside server. The game composable tests and vitest config are well-structured and will run correctly. The dependency-pinning test introduces a regression guard that is immediately broken: libraries/base/package.json still carries floating versions for both vue and @nuxt/eslint, causing multiple parameterized test cases to fail before any remediation is applied. Files Needing Attention: server/test/unit/dependency-pinning.test.ts — the workspaces array includes libraries/base, which has not been remediated and will cause test failures on every run until its floating versions are pinned. Important Files Changed
|
| ({ path }) => { | ||
| const pkg = readPackageJson(path); | ||
| const allDeps = { ...pkg.dependencies, ...pkg.devDependencies }; | ||
|
|
||
| for (const name of ["vue", "vue-router"] as const) { | ||
| const version = allDeps[name]; | ||
| if (version === undefined) continue; // not every workspace depends on both | ||
| expect( | ||
| FLOATING_VERSIONS.has(version), | ||
| `${path}: expected "${name}" to be pinned, but found "${version}"`, | ||
| ).toBe(false); | ||
| } | ||
| }, | ||
| ); | ||
|
|
||
| it.each(workspaces)( | ||
| "$name/package.json has no floating ('latest' or '*') dependency versions", | ||
| ({ path }) => { | ||
| const pkg = readPackageJson(path); | ||
| const allDeps = { ...pkg.dependencies, ...pkg.devDependencies }; | ||
|
|
||
| const floating = Object.entries(allDeps) | ||
| .filter(([, version]) => FLOATING_VERSIONS.has(version)) | ||
| .map(([name, version]) => `${name}@${version}`); | ||
|
|
||
| expect(floating).toEqual([]); | ||
| }, | ||
| ); | ||
|
|
||
| it("server and desktop/main resolve vue-router to the exact same version", () => { | ||
| // vue-router version drift between the two Nuxt apps in this monorepo | ||
| // is easy to miss and was part of the same remediation pass. | ||
| const server = readPackageJson("server/package.json"); | ||
| const desktopMain = readPackageJson("desktop/main/package.json"); | ||
|
|
||
| const serverVersion = | ||
| server.dependencies?.["vue-router"] ?? | ||
| server.devDependencies?.["vue-router"]; | ||
| const desktopVersion = | ||
| desktopMain.dependencies?.["vue-router"] ?? | ||
| desktopMain.devDependencies?.["vue-router"]; | ||
|
|
||
| expect(serverVersion).toBeDefined(); | ||
| expect(desktopVersion).toBeDefined(); | ||
| expect(serverVersion).toBe(desktopVersion); | ||
| }); |
There was a problem hiding this comment.
Tests will fail immediately —
server/package.json still uses "latest"
The dependency-pinning tests assert that server/package.json has no floating versions for vue and vue-router, but the server workspace was never remediated: it still carries "vue": "latest" and "vue-router": "latest" (lines 77–78 of server/package.json). All three parameterised test cases will fail on first run — the two "no 'latest'" cases will catch both packages, and the version-parity check will fail because desktop/main is now pinned to "4.5.1" while the server remains on "latest".
Prompt To Fix With AI
This is a comment left during a code review.
Path: server/test/unit/dependency-pinning.test.ts
Line: 37-82
Comment:
**Tests will fail immediately — `server/package.json` still uses `"latest"`**
The dependency-pinning tests assert that `server/package.json` has no floating versions for `vue` and `vue-router`, but the server workspace was never remediated: it still carries `"vue": "latest"` and `"vue-router": "latest"` (lines 77–78 of `server/package.json`). All three parameterised test cases will fail on first run — the two "no 'latest'" cases will catch both packages, and the version-parity check will fail because `desktop/main` is now pinned to `"4.5.1"` while the server remains on `"latest"`.
How can I resolve this? If you propose a fix, please make it concise.|
|
||
| expect(version.value).toEqual(initialVersion); | ||
| }); | ||
| }); No newline at end of file |
There was a problem hiding this comment.
Missing trailing newline — CI format check will reject this file
CLAUDE.md requires every edited file to be formatted immediately, and Prettier enforces a final newline. All three new files in this PR (game.test.ts, vitest.config.ts, and dependency-pinning.test.ts) are missing the trailing newline, so pnpm --filter drop format:check will fail in CI.
Context Used: CLAUDE.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: desktop/main/composables/game.test.ts
Line: 260
Comment:
**Missing trailing newline — CI format check will reject this file**
`CLAUDE.md` requires every edited file to be formatted immediately, and Prettier enforces a final newline. All three new files in this PR (`game.test.ts`, `vitest.config.ts`, and `dependency-pinning.test.ts`) are missing the trailing newline, so `pnpm --filter drop format:check` will fail in CI.
**Context Used:** CLAUDE.md ([source](https://app.greptile.com/heretek-ai/github/BillyOutlast/drop/-/custom-context?memory=990afeb5-70bf-42e6-b1b6-9a31e6269b3f))
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
|



Unit test generation was requested by @BillyOutlast.
The following files were modified:
desktop/main/composables/game.test.tsdesktop/main/package.jsondesktop/main/vitest.config.tsserver/test/unit/dependency-pinning.test.ts