test: improve utils test clarity and performance#11
Merged
JosunLP merged 3 commits intodevelopmentfrom Jan 24, 2026
Merged
Conversation
Security and Playground Fixes: * Replaced direct assignment of HTML via `innerHTML` with safer DOM manipulation in the `logEvent` function within `playground/src/demos/core.ts` to prevent possible HTML injection vulnerabilities. * Updated collection handling in the same file to use the raw DOM element when re-appending items, improving code clarity and safety. Workflow and Versioning: * Added explicit `contents: read` permissions to both `build` and `build-docs` jobs in `.github/workflows/npm-publish.yml` to comply with GitHub Actions best practices. [[1]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R16-R17) [[2]](diffhunk://#diff-8a5ce8b612395836520d0655143f732d08e747af57f3cfe76b5e283600106240R29-R30) * Bumped package version to `1.1.1` in `package.json` to reflect the new release. * Added a changelog entry for version `1.1.1` noting the HTML handling fix in `CHANGELOG.md`.
- Use descriptive variable name 'attempt' instead of generic 'i' - Reduce randomInt test iterations from 100 to 20 for faster execution - Add direct test for merge() result not containing polluted property Co-authored-by: JosunLP <20913954+JosunLP@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update variable name for better readability in tests
test: improve utils test clarity and performance
Jan 24, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates tests/utils.test.ts to improve readability, reduce unnecessary test iterations, and strengthen prototype-pollution assertions around utils.merge().
Changes:
- Renamed the
randomIntloop counter fromitoattemptfor clarity. - Reduced
randomInttest iterations from 100 to 20 to speed up the test while keeping the same range validation. - Added an assertion that the object returned from
merge()does not expose a polluted property.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Applied three targeted improvements to
tests/utils.test.ts:i→attemptin randomInt test loop for claritymerge()result doesn't inherit polluted propertiesThe merge security test now validates both that the prototype isn't polluted AND that the returned object itself doesn't contain the polluted property:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.