|
@@ -12,11 +12,37 @@ describe('EventsRegistry', () => {
|
12
|
12
|
|
13
|
13
|
it('exposes appLaunch event', () => {
|
14
|
14
|
const subscription = {};
|
15
|
|
- mockNativeEventsReceiver.registerAppLaunched.mockReturnValueOnce(subscription);
|
16
|
15
|
const cb = jest.fn();
|
|
16
|
+ mockNativeEventsReceiver.registerAppLaunched.mockReturnValueOnce(subscription);
|
|
17
|
+
|
17
|
18
|
const result = uut.appLaunched(cb);
|
|
19
|
+
|
|
20
|
+ expect(result).toBe(subscription);
|
18
|
21
|
expect(mockNativeEventsReceiver.registerAppLaunched).toHaveBeenCalledTimes(1);
|
19
|
22
|
expect(mockNativeEventsReceiver.registerAppLaunched).toHaveBeenCalledWith(cb);
|
20
|
|
- expect(subscription).toBe(result);
|
|
23
|
+ });
|
|
24
|
+
|
|
25
|
+ it('exposes componentDidAppear event', () => {
|
|
26
|
+ const subscription = {};
|
|
27
|
+ const cb = jest.fn();
|
|
28
|
+ mockNativeEventsReceiver.registerComponentDidAppear.mockReturnValueOnce(subscription);
|
|
29
|
+
|
|
30
|
+ const result = uut.componentDidAppear(cb);
|
|
31
|
+
|
|
32
|
+ expect(result).toBe(subscription);
|
|
33
|
+ expect(mockNativeEventsReceiver.registerComponentDidAppear).toHaveBeenCalledTimes(1);
|
|
34
|
+ expect(mockNativeEventsReceiver.registerComponentDidAppear).toHaveBeenCalledWith(cb);
|
|
35
|
+ });
|
|
36
|
+
|
|
37
|
+ it('exposes componentDidDisappear event', () => {
|
|
38
|
+ const subscription = {};
|
|
39
|
+ const cb = jest.fn();
|
|
40
|
+ mockNativeEventsReceiver.registerComponentDidDisappear.mockReturnValueOnce(subscription);
|
|
41
|
+
|
|
42
|
+ const result = uut.componentDidDisappear(cb);
|
|
43
|
+
|
|
44
|
+ expect(result).toBe(subscription);
|
|
45
|
+ expect(mockNativeEventsReceiver.registerComponentDidDisappear).toHaveBeenCalledTimes(1);
|
|
46
|
+ expect(mockNativeEventsReceiver.registerComponentDidDisappear).toHaveBeenCalledWith(cb);
|
21
|
47
|
});
|
22
|
48
|
});
|