Possible copy by array test coverage gaps
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 2.8k
- Forks
- 564
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 10
Description
I'm leveraging these unit tests to verify some "copy by array" polyfill implementations.
The tests appear to focus more on corner cases and less so on actual normal expected usage.
Some specific gaps I noticed:
- test/built-ins/Array/prototype/toSorted does not verify (also true of
TypedArray.prototype.toSorted):- The default comparator is the same as
Array.prototype.sort(e.g.assert.compareArray([11, 2].toSorted(), [11, 2])) - Custom comparators work (e.g.
assert.compareArray([11, 2].toSorted((a, b) => a - b), [2, 11]))
- The default comparator is the same as
- test/built-ins//TypedArray/prototype/toReversed does not verify:
- The output of the array is actually reversed
For other tests, the "happy path" is often not explicitly tested. Proper behavior is often verified while testing for different corner cases.
There seems to be a very specific format to the spec comments in the test files and the file naming convention--both of which I'm unfamiliar with--so I'm hesitant to offer to help fill these gaps.
If some guidance were provided on both these points, I'd be happy to help address these gaps.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing tests under test/built-ins/Array/prototype/toSorted and the corresponding TypedArray directories, including their spec comments and file naming patterns. Add normal-use coverage for default and custom toSorted comparators and verify that TypedArray.prototype.toReversed produces reversed output. Done means the listed happy paths are explicitly asserted in the appropriate test files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100