Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

### Fixes

- `[jest-worker]` Make `JestWorkerFarm` helper type to include methods of worker module that take more than one argument ([#12839](https://github.com/facebook/jest/pull/12839))
- `[@jest/expect-utils]` Fix deep equality of ImmutableJS OrderedMaps ([#12763](https://github.com/facebook/jest/pull/12899))
- `[jest-docblock]` Handle multiline comments in parseWithComments ([#12845](https://github.com/facebook/jest/pull/12845))
- `[jest-worker]` Make `JestWorkerFarm` helper type to include methods of worker module that take more than one argument ([#12839](https://github.com/facebook/jest/pull/12839))

### Chore & Maintenance

Expand Down
8 changes: 7 additions & 1 deletion packages/expect-utils/src/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
*/

import {List} from 'immutable';
import {List, OrderedMap} from 'immutable';
import {stringify} from 'jest-matcher-utils';
import {
arrayBufferEquality,
Expand Down Expand Up @@ -525,6 +525,12 @@ describe('iterableEquality', () => {

expect(iterableEquality(a, b)).toBe(true);
});

test('returns true when given Immutable OrderedMaps without an OwnerID', () => {
const a = OrderedMap().set('saving', true);
const b = OrderedMap().merge({saving: true});
expect(iterableEquality(a, b)).toBe(true);
});
});

describe('arrayBufferEquality', () => {
Expand Down
8 changes: 8 additions & 0 deletions packages/expect-utils/src/jasmineUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,11 @@ export function isImmutableList(maybeList: any) {
maybeList[IS_LIST_SENTINEL]
);
}

export function isImmutableOrderedKeyed(maybeKeyed: any) {
return !!(
maybeKeyed &&
maybeKeyed[IS_KEYED_SENTINEL] &&
maybeKeyed[IS_ORDERED_SENTINEL]
);
}
3 changes: 2 additions & 1 deletion packages/expect-utils/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
equals,
isA,
isImmutableList,
isImmutableOrderedKeyed,
isImmutableUnorderedKeyed,
isImmutableUnorderedSet,
} from './jasmineUtils';
Expand Down Expand Up @@ -255,7 +256,7 @@ export const iterableEquality = (
return false;
}

if (!isImmutableList(a)) {
if (!isImmutableList(a) && !isImmutableOrderedKeyed(a)) {
const aEntries = Object.entries(a);
const bEntries = Object.entries(b);
if (!equals(aEntries, bEntries)) {
Expand Down