diff --git a/Libraries/Animated/src/__tests__/Animated-test.js b/Libraries/Animated/src/__tests__/Animated-test.js index 1c2066bfd..6c5ef66b1 100644 --- a/Libraries/Animated/src/__tests__/Animated-test.js +++ b/Libraries/Animated/src/__tests__/Animated-test.js @@ -572,7 +572,7 @@ describe('Animated tests', () => { expect(listener.mock.calls.length).toBe(1); expect(listener).toBeCalledWith({foo: 42}); }); - it('should call forked event listeners', () => { + it('should call forked event listeners, with Animated.event() listener', () => { const value = new Animated.Value(0); const listener = jest.fn(); const handler = Animated.event([{foo: value}], {listener}); @@ -585,6 +585,24 @@ describe('Animated tests', () => { expect(listener2.mock.calls.length).toBe(1); expect(listener2).toBeCalledWith({foo: 42}); }); + it('should call forked event listeners, with js listener', () => { + const listener = jest.fn(); + const listener2 = jest.fn(); + const forkedHandler = Animated.forkEvent(listener, listener2); + forkedHandler({foo: 42}); + expect(listener.mock.calls.length).toBe(1); + expect(listener).toBeCalledWith({foo: 42}); + expect(listener2.mock.calls.length).toBe(1); + expect(listener2).toBeCalledWith({foo: 42}); + }); + it('should call forked event listeners, with undefined listener', () => { + const listener = undefined; + const listener2 = jest.fn(); + const forkedHandler = Animated.forkEvent(listener, listener2); + forkedHandler({foo: 42}); + expect(listener2.mock.calls.length).toBe(1); + expect(listener2).toBeCalledWith({foo: 42}); + }); }); describe('Animated Interactions', () => {