File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
packages/expect-utils/src Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 6
6
*
7
7
*/
8
8
9
+ import { List } from 'immutable' ;
9
10
import { stringify } from 'jest-matcher-utils' ;
10
11
import {
11
12
arrayBufferEquality ,
@@ -517,6 +518,13 @@ describe('iterableEquality', () => {
517
518
518
519
expect ( iterableEquality ( a , b ) ) . toBe ( true ) ;
519
520
} ) ;
521
+
522
+ test ( 'returns true when given Immutable Lists without an OwnerID' , ( ) => {
523
+ const a = List ( [ 1 , 2 , 3 ] ) ;
524
+ const b = a . filter ( v => v > 0 ) ;
525
+
526
+ expect ( iterableEquality ( a , b ) ) . toBe ( true ) ;
527
+ } ) ;
520
528
} ) ;
521
529
522
530
describe ( 'arrayBufferEquality' , ( ) => {
Original file line number Diff line number Diff line change @@ -181,11 +181,7 @@ export const iterableEquality = (
181
181
if ( a . size !== undefined ) {
182
182
if ( a . size !== b . size ) {
183
183
return false ;
184
- } else if (
185
- isA ( 'Set' , a ) ||
186
- isImmutableUnorderedSet ( a ) ||
187
- isImmutableList ( a )
188
- ) {
184
+ } else if ( isA ( 'Set' , a ) || isImmutableUnorderedSet ( a ) ) {
189
185
let allFound = true ;
190
186
for ( const aValue of a ) {
191
187
if ( ! b . has ( aValue ) ) {
@@ -259,6 +255,11 @@ export const iterableEquality = (
259
255
return false ;
260
256
}
261
257
258
+ if ( isImmutableList ( a ) ) {
259
+ // After iteration, Immutable Lists are equal
260
+ return true ;
261
+ }
262
+
262
263
const aEntries = Object . entries ( a ) ;
263
264
const bEntries = Object . entries ( b ) ;
264
265
if ( ! equals ( aEntries , bEntries ) ) {
You can’t perform that action at this time.
0 commit comments