fix: prevent infinite re-render loop from issue retry callbacks (#2550)
This commit is contained in:
committed by
dermotduffy
parent
c3d3dd3934
commit
3fe5e4004a
@@ -18,6 +18,7 @@ import {
|
||||
generateFloatApproximatelyEqualsCustomizer,
|
||||
getChildrenFromElement,
|
||||
getDurationString,
|
||||
ignoreFunctionIdentity,
|
||||
isHoverableDevice,
|
||||
isHTMLElement,
|
||||
isSuperset,
|
||||
@@ -523,6 +524,26 @@ describe('generateFloatApproximatelyEqualsCustomizer', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('ignoreFunctionIdentity', () => {
|
||||
it('should treat two functions as equal regardless of identity', () => {
|
||||
expect(
|
||||
ignoreFunctionIdentity(
|
||||
() => 1,
|
||||
() => 2,
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
it('should treat a function appearing as a real change', () => {
|
||||
expect(ignoreFunctionIdentity(() => 1, undefined)).toBe(false);
|
||||
});
|
||||
it('should treat a function disappearing as a real change', () => {
|
||||
expect(ignoreFunctionIdentity(undefined, () => 1)).toBe(false);
|
||||
});
|
||||
it('should defer to default equality for non-functions', () => {
|
||||
expect(ignoreFunctionIdentity(1, 2)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('convertHTTPAdressToWebsocket', () => {
|
||||
it('should convert http to ws', () => {
|
||||
expect(convertHTTPAdressToWebsocket('http://example.com')).toBe('ws://example.com');
|
||||
|
||||
Reference in New Issue
Block a user