Skip to content

Commit 2d66e21

Browse files
committed
Ignore call order in test
1 parent 882992a commit 2d66e21

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/BranchSubscriber.test.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ test('subscribes to init session success & error events', () => {
3737

3838
expect(subscriber._nativeEventEmitter.addListener.mock.calls.length).toBe(2)
3939

40-
// TODO: This is brittle because it depends on the order.
41-
expect(subscriber._nativeEventEmitter.addListener.mock.calls[0][0]).toBe(RNBranch.INIT_SESSION_SUCCESS)
42-
expect(subscriber._nativeEventEmitter.addListener.mock.calls[1][0]).toBe(RNBranch.INIT_SESSION_ERROR)
40+
// This comparison ignores the call order.
41+
const mockArgs = subscriber._nativeEventEmitter.addListener.mock.calls.map(call => call[0]).sort()
42+
expect(mockArgs).toEqual([
43+
RNBranch.INIT_SESSION_ERROR,
44+
RNBranch.INIT_SESSION_SUCCESS,
45+
])
4346
})

0 commit comments

Comments
 (0)