Skip to content

feat: added unit tests#2539

Open
RohitKushvaha01 wants to merge 1 commit into
Acode-Foundation:mainfrom
RohitKushvaha01:vitests
Open

feat: added unit tests#2539
RohitKushvaha01 wants to merge 1 commit into
Acode-Foundation:mainfrom
RohitKushvaha01:vitests

Conversation

@RohitKushvaha01

Copy link
Copy Markdown
Member

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a Vitest-based unit-testing setup.

  • Adds npm scripts and the Vitest dependency.
  • Configures source-directory aliases and limits collection to tests/**/*.test.{js,ts}.
  • Adds unit coverage for paths, URLs, URIs, colors, versions, binary detection, install source, task management, and quick-tools state.

Confidence Score: 4/5

The PR appears safe to merge, but CI should run the new suite and the quick-tools test should assert intended cleanup behavior instead of preserving a known defect.

The test setup and assertions are generally consistent with the implementations, while the accepted concerns affect the suite’s automated enforcement and the maintainability of one defective behavior rather than production execution.

Files Needing Attention: package.json; tests/unit/quickToolsState.test.js

Important Files Changed

Filename Overview
package.json Adds Vitest and local test scripts, but the new suite is not invoked by CI.
vitest.config.js Adds source aliases and isolates Node unit tests from the on-device runtime harness.
tests/unit/quickToolsState.test.js Adds state-helper coverage but includes an assertion that deliberately preserves acknowledged defective cleanup behavior.
tests/unit/taskManager.test.js Adds linear and parallel execution tests consistent with the task manager implementation.
package-lock.json Locks Vitest 4.1.10 and its new transitive test-tooling dependencies.

Reviews (1): Last reviewed commit: "feat: added unit tests" | Re-trigger Greptile

Comment thread package.json
Comment on lines +20 to +21
"test": "vitest run",
"test:watch": "vitest"

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.

P2 Unit tests are not automated

The new Vitest suite is exposed only through local npm scripts; the existing CI workflows never invoke npm test, so regressions covered by these tests can merge while all required checks pass.

Comment on lines +101 to +110
it("skips containers that match themselves", () => {
// The implementation marks each container as visited before checking
// whether the container itself matches, so the self-match branch never
// clears it. This pins the current behavior.
const container = fakeContainer([], true);
container.dataset = { timeout: "456" };
container.classList = fakeButton(["active"]).classList;

expect(clearQuickToolsButtonFeedback([container])).toBe(0);
});

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.

P2 Test preserves defective cleanup

This test explicitly pins the behavior where a matching container retains active feedback. Correcting the cleanup implementation to clear that container will therefore fail the regression suite and encourage preservation of stale UI state.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant