Skip to content

CodeRabbit Generated Unit Tests: Add Generated Unit Tests for PR Changes - #44

Merged
BillyOutlast merged 2 commits into
developfrom
coderabbitai/utg/9d0ef6e
Jul 26, 2026
Merged

BillyOutlast merged 2 commits into
developfrom
coderabbitai/utg/9d0ef6e

Conversation

@coderabbitai

@coderabbitai coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Unit test generation was requested by @BillyOutlast.

The following files were modified:

  • desktop/main/composables/game.test.ts
  • desktop/main/package.json
  • desktop/main/vitest.config.ts
  • server/test/unit/dependency-pinning.test.ts

@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown
Author

Important

Review skipped

This 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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 36c9c6e3-c775-4e9d-acd5-161d71b25c03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key: "auto_review"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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

@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds unit tests generated by CodeRabbit: tests for the game composable in desktop/main, a vitest config for that workspace, and a dependency-pinning regression guard in the server workspace. desktop/main/package.json also pins vue-router from "latest" to "4.5.1" and adds vue@3.5.17 as a pinned devDependency.

  • game.test.ts covers parseStatus and useGame (caching, event handler wiring, version ref updates) and correctly uses unique gameIds per test to avoid registry cross-contamination via module-level singletons.
  • dependency-pinning.test.ts adds a regression guard asserting no workspace uses "latest" or "*" for vue/vue-router, but it lists libraries/base as a tested workspace even though libraries/base/package.json still carries "vue": "latest" and "@nuxt/eslint": "latest", causing multiple test-case failures immediately alongside the already-unfixed server/package.json.

Confidence Score: 4/5

The 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

Filename Overview
desktop/main/composables/game.test.ts New unit tests for the game composable — good coverage of parseStatus and useGame caching/event logic; uses unique gameIds per test to avoid registry cross-contamination; relies on vi.stubGlobal("ref", ref) to satisfy Nuxt's auto-import at runtime
desktop/main/package.json Adds vitest devDependency, a test script, and pins vue-router from "latest" to "4.5.1"; vue is also pinned to "3.5.17" as a devDependency
desktop/main/vitest.config.ts New vitest config for desktop/main — sets up "~" alias pointing to the workspace root, node environment, and includes all *.test.ts files
server/test/unit/dependency-pinning.test.ts New regression guard for CONF-1/CONF-2; tests will fail immediately because server/package.json (vue/vue-router still "latest") and libraries/base/package.json (vue and @nuxt/eslint still "latest") were not remediated alongside desktop/main

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[dependency-pinning.test.ts] --> B[it.each workspaces]
    B --> C[server/package.json]
    B --> D[desktop/main/package.json]
    B --> E[libraries/base/package.json]

    C --> F{vue / vue-router\npinned?}
    D --> G{vue / vue-router\npinned?}
    E --> H{vue / vue-router\npinned?}

    F -- vue=latest\nvue-router=latest --> I[FAIL]
    G -- vue-router=4.5.1\nvue=3.5.17 --> J[PASS]
    H -- vue=latest --> K[FAIL]

    C --> L{no floating\nversions?}
    D --> M{no floating\nversions?}
    E --> N{no floating\nversions?}

    L -- vue@latest\nvue-router@latest --> O[FAIL]
    M --> P[PASS]
    N -- vue@latest\n@nuxt-eslint@latest --> Q[FAIL]

    R[version parity check\nserver vs desktop/main] --> S[vue-router: latest vs 4.5.1]
    S --> T[FAIL]
Loading

Reviews (2): Last reviewed commit: "Update desktop/main/vitest.config.ts" | Re-trigger Greptile

Comment on lines +37 to +82
({ 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);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 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!

Comment thread desktop/main/vitest.config.ts
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@BillyOutlast
BillyOutlast merged commit 85f7ccc into develop Jul 26, 2026
13 of 21 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant