Skip to content

🧪 test: add unit tests for deleteItemFromTree - #11

Open
beingniloy wants to merge 2 commits into
mainfrom
testing-improvement-delete-item-from-tree-7162340052108659191
Open

🧪 test: add unit tests for deleteItemFromTree#11
beingniloy wants to merge 2 commits into
mainfrom
testing-improvement-delete-item-from-tree-7162340052108659191

Conversation

@beingniloy

Copy link
Copy Markdown
Owner

This PR addresses the testing gap by adding comprehensive unit tests for the pure helper function deleteItemFromTree in src/utils.ts.

🎯 What

The testing gap for deleteItemFromTree has been addressed by introducing vitest unit tests.

📊 Coverage

The new test suite covers:

  • Empty file tree.
  • Root-level file deletion.
  • Root-level folder deletion.
  • Nested deep item deletion.
  • Non-existent path behavior.
  • Immutability and reference integrity (ensuring unchanged nodes keep their references, while modified node paths get cloned).

✨ Result

These tests ensure deleteItemFromTree works reliably and correctly handles the tree structure and immutability. All tests pass successfully under pnpm test.


PR created automatically by Jules for task 7162340052108659191 started by @beingniloy

Added a complete unit test suite for deleteItemFromTree in src/utils.test.ts. Tested various scenarios:
- Deleting root-level file/folder
- Deleting deeply nested file/folder
- Immutability and reference cloning checks
- Handling empty list
- Unaffected tree when path does not exist

Also added standard test script 'vitest run' to package.json.

Co-authored-by: beingniloy <235952944+beingniloy@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Added a complete unit test suite for deleteItemFromTree in src/utils.test.ts using node:test and node:assert/strict. Tested various scenarios:
- Deleting root-level file/folder
- Deleting deeply nested file/folder
- Immutability and reference cloning checks
- Handling empty list
- Unaffected tree when path does not exist

Also added standard test script 'tsx --test src/utils.test.ts' to package.json, and added tsx as a devDependency.

Co-authored-by: beingniloy <235952944+beingniloy@users.noreply.github.com>
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