@applicaster/quick-brick-core 16.0.0-rc.62 → 16.0.0-rc.64
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.
package/App/DeepLinking/URLSchemeHandler/SchemeHandlerHooks/__tests__/useOpenSchemeHandler.test.tsx
CHANGED
|
@@ -60,11 +60,21 @@ jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
|
|
|
60
60
|
const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
|
|
61
61
|
const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
|
|
62
62
|
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
jest.
|
|
63
|
+
const mockSetEntryContext = jest.fn();
|
|
64
|
+
|
|
65
|
+
// `jest.mock` is hoisted above the imports, so the entry context is replaced
|
|
66
|
+
// before anything can pull the real one in. `jest.doMock` is not hoisted, and
|
|
67
|
+
// only worked here for as long as no import above happened to load this module
|
|
68
|
+
// first - which any new import anywhere in the graph could silently undo,
|
|
69
|
+
// leaving the hook writing to the real context while the spy stayed at zero
|
|
70
|
+
// calls. The rest of the module is kept, since other consumers loaded by this
|
|
71
|
+
// graph read other exports from it.
|
|
72
|
+
jest.mock("@applicaster/zapp-react-native-ui-components/Contexts", () => ({
|
|
73
|
+
...jest.requireActual(
|
|
74
|
+
"@applicaster/zapp-react-native-ui-components/Contexts"
|
|
75
|
+
),
|
|
66
76
|
ZappPipesEntryContext: {
|
|
67
|
-
useZappPipesContext: () => [{},
|
|
77
|
+
useZappPipesContext: () => [{}, mockSetEntryContext],
|
|
68
78
|
},
|
|
69
79
|
}));
|
|
70
80
|
|
|
@@ -76,7 +86,7 @@ jest.mock("../../../logger", () => ({
|
|
|
76
86
|
log_debug: jest.fn(),
|
|
77
87
|
}));
|
|
78
88
|
|
|
79
|
-
//
|
|
89
|
+
// Required after the mocks above, so the hook binds to them.
|
|
80
90
|
const { useOpenSchemeHandler } = require("../useOpenSchemeHandler");
|
|
81
91
|
|
|
82
92
|
const mockStoreObj = { rivers, contentTypes, pipesEndpoints, appData };
|
|
@@ -101,7 +111,7 @@ function clearMocks() {
|
|
|
101
111
|
navigator.replace.mockClear();
|
|
102
112
|
navigator.push.mockClear();
|
|
103
113
|
navigator.goHome.mockClear();
|
|
104
|
-
|
|
114
|
+
mockSetEntryContext.mockClear();
|
|
105
115
|
}
|
|
106
116
|
|
|
107
117
|
describe("useOpenSchemeHandler", () => {
|
|
@@ -215,7 +225,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
215
225
|
})
|
|
216
226
|
);
|
|
217
227
|
|
|
218
|
-
expect(
|
|
228
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
219
229
|
expect.objectContaining({
|
|
220
230
|
...params,
|
|
221
231
|
extensions: { ...params, initial_player_state: "fullscreen" },
|
|
@@ -272,7 +282,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
272
282
|
})
|
|
273
283
|
);
|
|
274
284
|
|
|
275
|
-
expect(
|
|
285
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
276
286
|
expect.objectContaining({
|
|
277
287
|
...params,
|
|
278
288
|
extensions: { ...params, initial_player_state: "fullscreen" },
|
|
@@ -331,7 +341,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
331
341
|
})
|
|
332
342
|
);
|
|
333
343
|
|
|
334
|
-
expect(
|
|
344
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
335
345
|
entryWithInitialPlayerState
|
|
336
346
|
);
|
|
337
347
|
};
|
|
@@ -361,7 +371,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
361
371
|
})
|
|
362
372
|
);
|
|
363
373
|
|
|
364
|
-
expect(
|
|
374
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
365
375
|
entryWithInitialPlayerState
|
|
366
376
|
);
|
|
367
377
|
};
|
|
@@ -391,7 +401,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
391
401
|
})
|
|
392
402
|
);
|
|
393
403
|
|
|
394
|
-
expect(
|
|
404
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
395
405
|
entryWithInitialPlayerState
|
|
396
406
|
);
|
|
397
407
|
};
|
|
@@ -421,7 +431,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
421
431
|
})
|
|
422
432
|
);
|
|
423
433
|
|
|
424
|
-
expect(
|
|
434
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
425
435
|
entryWithInitialPlayerState
|
|
426
436
|
);
|
|
427
437
|
};
|
|
@@ -451,7 +461,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
451
461
|
})
|
|
452
462
|
);
|
|
453
463
|
|
|
454
|
-
expect(
|
|
464
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
455
465
|
entryWithInitialPlayerState
|
|
456
466
|
);
|
|
457
467
|
};
|
|
@@ -485,7 +495,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
485
495
|
})
|
|
486
496
|
);
|
|
487
497
|
|
|
488
|
-
expect(
|
|
498
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
489
499
|
expect.objectContaining(entryWithInitialPlayerState)
|
|
490
500
|
);
|
|
491
501
|
};
|
|
@@ -514,7 +524,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
514
524
|
);
|
|
515
525
|
|
|
516
526
|
expect(navigator.goHome).toHaveBeenCalled();
|
|
517
|
-
expect(
|
|
527
|
+
expect(mockSetEntryContext).not.toHaveBeenCalled();
|
|
518
528
|
};
|
|
519
529
|
|
|
520
530
|
await testHook({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "16.0.0-rc.
|
|
3
|
+
"version": "16.0.0-rc.64",
|
|
4
4
|
"description": "Core package for Applicaster's Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@applicaster/applicaster-types": "16.0.0-rc.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "16.0.0-rc.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "16.0.0-rc.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "16.0.0-rc.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "16.0.0-rc.
|
|
31
|
+
"@applicaster/applicaster-types": "16.0.0-rc.64",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "16.0.0-rc.64",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "16.0.0-rc.64",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "16.0.0-rc.64",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "16.0.0-rc.64",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "16.0.0-rc.64",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "16.0.0-rc.64",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|