Skip to content

Commit 599962e

Browse files
committed
fix get for test
1 parent 8a70b64 commit 599962e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/utils/Subscription.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ function createListenerCollection() {
2424
}
2525
})
2626
},
27+
28+
get() {
29+
return current
30+
},
31+
2732
subscribe: function subscribe(listener) {
2833
var currentId = id++
2934
current[currentId] = listener

test/hooks/useSelector.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ describe('React', () => {
9797
</ProviderMock>
9898
)
9999

100-
expect(rootSubscription.listeners.get().length).toBe(1)
100+
expect(Object.keys(rootSubscription.listeners.get()).length).toBe(1)
101101

102102
store.dispatch({ type: '' })
103103

104-
expect(rootSubscription.listeners.get().length).toBe(2)
104+
expect(Object.keys(rootSubscription.listeners.get()).length).toBe(2)
105105
})
106106

107107
it('unsubscribes when the component is unmounted', () => {
@@ -125,11 +125,11 @@ describe('React', () => {
125125
</ProviderMock>
126126
)
127127

128-
expect(rootSubscription.listeners.get().length).toBe(2)
128+
expect(Object.keys(rootSubscription.listeners.get()).length).toBe(2)
129129

130130
store.dispatch({ type: '' })
131131

132-
expect(rootSubscription.listeners.get().length).toBe(1)
132+
expect(Object.keys(rootSubscription.listeners.get()).length).toBe(1)
133133
})
134134

135135
it('notices store updates between render and store subscription effect', () => {

0 commit comments

Comments
 (0)