test: wire desktop and utils coverage into turbo#1808
Conversation
Brin PR Security ScanThis PR has findings that should be reviewed.
Findings:
Analyzed by Brin |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
| it("prefers upload progress over processing progress", () => { | ||
| expect(getDisplayProgress(42, 10)).toBe(42); | ||
| expect(getDisplayProgress(undefined, 64)).toBe(64); | ||
| }); |
There was a problem hiding this comment.
The
getDisplayProgress test skips the uploadProgress = 0 case. Because the implementation checks uploadProgress !== undefined, passing 0 returns 0 and never falls back to processingProgress. This is a non-obvious semantic boundary worth pinning so a future change to === undefined vs. a falsy check doesn't silently regress.
| it("prefers upload progress over processing progress", () => { | |
| expect(getDisplayProgress(42, 10)).toBe(42); | |
| expect(getDisplayProgress(undefined, 64)).toBe(64); | |
| }); | |
| it("prefers upload progress over processing progress", () => { | |
| expect(getDisplayProgress(42, 10)).toBe(42); | |
| expect(getDisplayProgress(undefined, 64)).toBe(64); | |
| // uploadProgress=0 is defined, so processing progress is NOT used | |
| expect(getDisplayProgress(0, 64)).toBe(0); | |
| }); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/utils/src/helpers.test.ts
Line: 35-38
Comment:
The `getDisplayProgress` test skips the `uploadProgress = 0` case. Because the implementation checks `uploadProgress !== undefined`, passing `0` returns `0` and never falls back to `processingProgress`. This is a non-obvious semantic boundary worth pinning so a future change to `=== undefined` vs. a falsy check doesn't silently regress.
```suggestion
it("prefers upload progress over processing progress", () => {
expect(getDisplayProgress(42, 10)).toBe(42);
expect(getDisplayProgress(undefined, 64)).toBe(64);
// uploadProgress=0 is defined, so processing progress is NOT used
expect(getDisplayProgress(0, 64)).toBe(0);
});
```
How can I resolve this? If you propose a fix, please make it concise.| "typecheck": "tsc -b", | ||
| "build": "tsdown" | ||
| "build": "tsdown", | ||
| "test": "vitest run" |
There was a problem hiding this comment.
@cap/utils has no vitest.config.ts. Vitest will default to Node environment and the standard **/*.test.* glob, which works for the current pure-function tests. As the package grows (or if path aliases from tsconfig are needed), the absence of an explicit config may cause friction. Consider adding a minimal config now to make the test environment intentional.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/utils/package.json
Line: 10
Comment:
`@cap/utils` has no `vitest.config.ts`. Vitest will default to Node environment and the standard `**/*.test.*` glob, which works for the current pure-function tests. As the package grows (or if path aliases from `tsconfig` are needed), the absence of an explicit config may cause friction. Consider adding a minimal config now to make the test environment intentional.
How can I resolve this? If you propose a fix, please make it concise.
Summary
testscript so existing Vitest coverage participates in the root Turbopnpm testpipeline@cap/utilsVitest suite covering shared helper behavior for class merging, UUID formatting, progress math, and signup email restrictions/claim #54
AI-assisted with Codex; I reviewed the diff and kept the change scoped to test infrastructure and example tests.
Verification
pnpm install --frozen-lockfilepnpm turbo run test --filter=@cap/desktop --filter=@cap/utilspnpm exec biome check apps/desktop/package.json packages/utils/package.json packages/utils/src/helpers.test.tsGreptile Summary
This PR wires existing Vitest coverage in
@cap/desktopinto the root Turbotestpipeline and adds the first@cap/utilstest suite covering class merging, UUID round-trips, progress circle geometry, display-progress selection, and email restriction logic.apps/desktop/package.jsongains a generic\"test\": \"vitest run\"script; the package already hadvitestand a config, so the 4 existingsrc/utils/*.test.tsfiles and the memory-soak unit tests will all participate correctly.packages/utils/package.jsonadds\"test\": \"vitest run\"andvitest ~2.1.9as a devDependency; the newhelpers.test.tscovers 7 exported functions with assertions that match the implementation, though theuploadProgress = 0edge case ofgetDisplayProgressis not exercised.Confidence Score: 4/5
Safe to merge; changes are limited to test infrastructure and a new test file with no production code modifications.
All production code is untouched. The new tests are correct against the implementation. The only gaps are a missing edge-case assertion for
getDisplayProgress(0, n)and the absence of an explicitvitest.config.tsin@cap/utils, both of which are non-blocking quality observations.No files require special attention;
packages/utils/src/helpers.test.tshas a minor coverage gap worth a quick look.Important Files Changed
getDisplayProgress(0, n)edge case is untested and has non-obvious semantics.testscript andvitest ~2.1.9devDependency; novitest.config.tsis present, so the package runs with defaults.testscript wired tovitest run; vitest and config already existed, and existing unit tests will be picked up correctly.vitest ~2.1.9inpackages/utils, resolving to the same version already used by desktop — consistent.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "test: wire desktop and utils coverage in..." | Re-trigger Greptile