test(compat/each): replace each duplicate tests with an alias check against forEach#1873
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| it('should be an alias of forEach', () => { | ||
| expect(each).toBe(forEach); |
There was a problem hiding this comment.
I noticed that alias functions didn't have dedicated test files before. How about keeping the test file, as it is now, but only adding a test that verifies the alias references the same implementation as the original function?
There was a problem hiding this comment.
As far as I understand, that's actually already what this PR does.
each.spec.ts stays right where it is; we just trimmed it down to a single test confirming each is the same implementation as forEach:
describe('each', () => {
it('should be an alias of forEach', () => {
expect(each).toBe(forEach);
});
});Only the duplicated behavioral cases were removed, since forEach.spec.ts already covers those. Let me know if you meant something a bit different, happy to adjust!
There was a problem hiding this comment.
As far as I understand, that's actually already what this PR does.
each.spec.tsstays right where it is; we just trimmed it down to a single test confirmingeachis the same implementation asforEach:describe('each', () => { it('should be an alias of forEach', () => { expect(each).toBe(forEach); }); });Only the duplicated behavioral cases were removed, since
forEach.spec.tsalready covers those. Let me know if you meant something a bit different, happy to adjust!
I actually meant asking whether we should add the same kind of test for the other aliases too, like first, extend ...
It looks like this is already being worked on :) -> #1883
Summary
We could delegate the specific test cases for the alias each to
forEach. SinceforEachis already thoroughly tested andeachis simply an alias of it, that should be sufficient.