@applicaster/quick-brick-core 13.0.0-rc.5 → 13.0.0-rc.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/App/ActionsProvider/__tests__/__snapshots__/ActionsProvider.test.js.snap +7 -7
  2. package/App/AssetCache/__tests__/__snapshots__/assetCache.test.ts.snap +103 -103
  3. package/App/AssetCache/__tests__/assetCache.test.ts +3 -2
  4. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/__snapshots__/schemeHandlerHooks.test.ts.snap +1 -1
  5. package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx +45 -116
  6. package/App/DeepLinking/URLSchemeHandler/__tests__/__snapshots__/URLSchemeHandler.test.tsx.snap +3 -3
  7. package/App/DeepLinking/URLSchemeListener/URLSchemeContextProvider.tsx +30 -3
  8. package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListener.test.js +40 -0
  9. package/App/DeepLinking/URLSchemeListener/index.tsx +1 -1
  10. package/App/ErrorBoundary/__tests__/errorBoundary.test.js +20 -37
  11. package/App/LoadingOverlay/LoadingOverlayManager.tsx +27 -0
  12. package/App/LoadingOverlay/index.tsx +49 -0
  13. package/App/LoadingOverlay/useLoadingOverlayVisibility.tsx +18 -0
  14. package/App/ModalProvider/ModalBottomSheet/index.tsx +4 -2
  15. package/App/ModalProvider/index.tsx +3 -4
  16. package/App/NavigationProvider/NavigationProvider.tsx +48 -20
  17. package/App/NavigationProvider/__tests__/__snapshots__/navigationProvider.test.tsx.snap +20 -22
  18. package/App/NavigationProvider/navigator/__tests__/__snapshots__/reducer.test.ts.snap +189 -189
  19. package/App/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +2 -2
  20. package/App/StoreConnector/__tests__/storeConnector.test.js +17 -11
  21. package/App/appLifeCycleManager/__tests__/__snapshots__/appLifeCycleManager.test.js.snap +4 -4
  22. package/App/appLifeCycleManager/__tests__/appLifeCycleManager.test.js +5 -5
  23. package/App/appLifeCycleManager/index.tsx +2 -3
  24. package/App/index.tsx +2 -0
  25. package/App/remoteContextReloader/__tests__/remoteContextReloader.test.js +11 -21
  26. package/App/remoteContextReloader/consts.ts +2 -0
  27. package/App/remoteContextReloader/getRemoteContextData/getNativeRemoteContextData.ts +17 -6
  28. package/createZappApp/__tests__/__snapshots__/createZappApp.test.js.snap +5 -128
  29. package/createZappApp/__tests__/createZappApp.test.js +7 -20
  30. package/defaults/__tests__/defaults.test.js +3 -4
  31. package/index.d.ts +1 -1
  32. package/package.json +27 -11
  33. package/App/DeepLinking/URLSchemeListener/__tests__/URLSchemeListenerTest.js +0 -177
  34. package/App/ErrorBoundary/__tests__/__snapshots__/errorBoundary.test.js.snap +0 -9
  35. package/App/StoreConnector/__tests__/__snapshots__/storeConnector.test.js.snap +0 -35
  36. package/App/remoteContextReloader/__tests__/__snapshots__/remoteContextReloader.test.js.snap +0 -43
@@ -1,177 +0,0 @@
1
- import * as React from "react";
2
- import { View, Text } from "react-native";
3
- import { shallow } from "enzyme";
4
- import { shallowToJson } from "enzyme-to-json";
5
-
6
- import { URLSchemeListener } from "../index";
7
-
8
- const URL = "url";
9
-
10
- const TestComponent = () => (
11
- <View>
12
- <Text>I'm a test component</Text>
13
- </View>
14
- );
15
-
16
- const ReactNative = require("react-native");
17
- const { Linking } = ReactNative;
18
-
19
- const navigator = {
20
- push: jest.fn(),
21
- replace: jest.fn(),
22
- };
23
-
24
- jest.spyOn(console, "warn").mockImplementation(() => jest.fn());
25
-
26
- function clearMocks() {
27
- navigator.push.mockClear();
28
- navigator.replace.mockClear();
29
- console.warn.mockClear(); // eslint-disable-line no-console
30
- Linking.__resetListeners();
31
- Linking.__clearInitialURL();
32
- Linking.addEventListener.mockClear();
33
- Linking.removeEventListener.mockClear();
34
- Linking.getInitialURL.mockClear();
35
- Linking.openURL.mockClear();
36
- }
37
-
38
- describe("URLSchemeHandler", () => {
39
- const getWrapper = (props) =>
40
- shallow(
41
- <URLSchemeListener navigator={navigator} {...props}>
42
- <TestComponent />
43
- </URLSchemeListener>
44
- );
45
-
46
- beforeEach(clearMocks);
47
-
48
- it("renders correctly", () => {
49
- const wrapper = getWrapper();
50
- expect(shallowToJson(wrapper)).toMatchSnapshot();
51
- });
52
-
53
- describe("linking registration", () => {
54
- beforeEach(clearMocks);
55
-
56
- it("registers the listener when the component mounts", () => {
57
- const wrapper = getWrapper();
58
- const instance = wrapper.instance();
59
-
60
- expect(shallowToJson(wrapper)).toMatchSnapshot();
61
-
62
- expect(Linking.addEventListener).toHaveBeenCalledWith(
63
- URL,
64
- instance.handleOpenUrl
65
- );
66
- });
67
-
68
- it("unregisters the listener when the component unmounts", () => {
69
- const wrapper = getWrapper();
70
- const instance = wrapper.instance();
71
- wrapper.unmount();
72
-
73
- expect(Linking.removeEventListener).toHaveBeenCalledWith(
74
- URL,
75
- instance.handleOpenUrl
76
- );
77
- });
78
- });
79
-
80
- describe("initial url", () => {
81
- beforeEach(clearMocks);
82
-
83
- it("tries to get the initial url", () => {
84
- const listenerSpy = jest.fn();
85
- const wrapper = getWrapper({ listenerSpy });
86
-
87
- expect(shallowToJson(wrapper)).toMatchSnapshot();
88
- expect(listenerSpy).toHaveBeenCalledWith("getInitialURL");
89
- expect(Linking.getInitialURL).toHaveBeenCalled();
90
- });
91
-
92
- it("gets the initial url and redirect to it if it exists", async () => {
93
- const listenerSpy = jest.fn();
94
- const url = "http://foo.com";
95
- Linking.__setInitialURL(url);
96
-
97
- const wrapper = getWrapper({ listenerSpy });
98
- const instance = wrapper.instance();
99
-
100
- await instance.componentDidMount();
101
-
102
- expect(listenerSpy).toHaveBeenCalledWith("getInitialURL");
103
-
104
- expect(navigator.replace).toHaveBeenCalledWith(
105
- expect.objectContaining({ url })
106
- );
107
- });
108
-
109
- it("doesn't try to navigate if there is no initial url", async () => {
110
- const listenerSpy = jest.fn();
111
-
112
- const wrapper = getWrapper({ listenerSpy });
113
- const instance = wrapper.instance();
114
- jest.spyOn(instance, "handleOpenUrlError");
115
-
116
- await instance.componentDidMount();
117
-
118
- expect(listenerSpy).toHaveBeenCalledWith("getInitialURL");
119
- expect(listenerSpy).not.toHaveBeenCalledWith("canOpenURL");
120
- expect(navigator.replace).not.toHaveBeenCalled();
121
- });
122
- });
123
-
124
- describe("url scheme handler", () => {
125
- beforeEach(clearMocks);
126
-
127
- it("invokes the listener when a url is triggered", () => {
128
- const listenerSpy = jest.fn();
129
- const wrapper = getWrapper({ listenerSpy });
130
- const url = "http://foo.com";
131
-
132
- Linking.__callUrl(url);
133
-
134
- expect(shallowToJson(wrapper)).toMatchSnapshot();
135
-
136
- expect(listenerSpy).toHaveBeenCalledWith(
137
- "handleOpenUrl",
138
- expect.objectContaining({ url })
139
- );
140
- });
141
-
142
- it("invokes the navigator if a url is triggered and the url is valid", async () => {
143
- const listenerSpy = jest.fn();
144
- const wrapper = getWrapper({ listenerSpy });
145
- const instance = wrapper.instance();
146
- const spy = jest.spyOn(instance, "handleOpenUrl");
147
- const url = "http://foo.com";
148
-
149
- Linking.__callUrl(url);
150
-
151
- await spy;
152
-
153
- expect(navigator.replace).toHaveBeenCalledWith(
154
- expect.objectContaining({ url })
155
- );
156
- });
157
-
158
- it("doesn't invoke the navigator if a url is triggered and the url is undefined", async () => {
159
- const listenerSpy = jest.fn();
160
- const wrapper = getWrapper({ listenerSpy });
161
- const instance = wrapper.instance();
162
- const spy = jest.spyOn(instance, "handleOpenUrl");
163
- const url = undefined; // eslint-disable no-undefined
164
-
165
- Linking.__callUrl(url);
166
-
167
- await spy;
168
-
169
- expect(listenerSpy).toHaveBeenCalledWith(
170
- "handleOpenUrl",
171
- expect.objectContaining({ url })
172
- );
173
-
174
- expect(navigator.replace).not.toHaveBeenCalled();
175
- });
176
- });
177
- });
@@ -1,9 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<ErrorBoundary /> When an error is caught renders correctly 1`] = `
4
- <ErrorScreen
5
- dismissError={[Function]}
6
- />
7
- `;
8
-
9
- exports[`<ErrorBoundary /> when there is no error renders correctly 1`] = `<TestComponent />`;
@@ -1,35 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`storeConnector passes the props to the component 1`] = `
4
- <Component
5
- appSettings={
6
- Object {
7
- "bundleIdentifier": "com.app.test",
8
- }
9
- }
10
- components={
11
- Object {
12
- "grid": [MockFunction],
13
- }
14
- }
15
- dispatch={[Function]}
16
- rivers={
17
- Object {
18
- "A123": Object {
19
- "id": "A123",
20
- "name": "home",
21
- },
22
- }
23
- }
24
- store={
25
- Object {
26
- "clearActions": [Function],
27
- "dispatch": [Function],
28
- "getActions": [Function],
29
- "getState": [Function],
30
- "replaceReducer": [Function],
31
- "subscribe": [Function],
32
- }
33
- }
34
- />
35
- `;
@@ -1,43 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`remoteContextReloader adds a componentDidMount method 1`] = `
4
- <Component
5
- appSettings={
6
- Object {
7
- "runtimeConfigurationUrls": Object {
8
- "foo": "bar",
9
- },
10
- }
11
- }
12
- dispatch={[MockFunction]}
13
- plugins={Array []}
14
- />
15
- `;
16
-
17
- exports[`remoteContextReloader when in __DEV__ doesn't invoke the context reloader 1`] = `
18
- <Component
19
- appSettings={
20
- Object {
21
- "runtimeConfigurationUrls": Object {
22
- "foo": "bar",
23
- },
24
- }
25
- }
26
- dispatch={[MockFunction]}
27
- plugins={Array []}
28
- />
29
- `;
30
-
31
- exports[`remoteContextReloader when not in __DEV__ invokes the context reloader 1`] = `
32
- <Component
33
- appSettings={
34
- Object {
35
- "runtimeConfigurationUrls": Object {
36
- "foo": "bar",
37
- },
38
- }
39
- }
40
- dispatch={[MockFunction]}
41
- plugins={Array []}
42
- />
43
- `;