@applicaster/quick-brick-core 15.1.7 → 15.1.8
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
|
@@ -61,11 +61,21 @@ jest.spyOn(useNavigationHooks, "useNavigation").mockReturnValue(navigator);
|
|
|
61
61
|
const helperSpy = jest.spyOn(helpers, "handlePresentNavigation");
|
|
62
62
|
const feedLoaderSpy = jest.spyOn(feedLoader, "useFeedLoader");
|
|
63
63
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
jest.
|
|
64
|
+
const mockSetEntryContext = jest.fn();
|
|
65
|
+
|
|
66
|
+
// `jest.mock` is hoisted above the imports, so the entry context is replaced
|
|
67
|
+
// before anything can pull the real one in. `jest.doMock` is not hoisted, and
|
|
68
|
+
// only worked here for as long as no import above happened to load this module
|
|
69
|
+
// first - which any new import anywhere in the graph could silently undo,
|
|
70
|
+
// leaving the hook writing to the real context while the spy stayed at zero
|
|
71
|
+
// calls. The rest of the module is kept, since other consumers loaded by this
|
|
72
|
+
// graph read other exports from it.
|
|
73
|
+
jest.mock("@applicaster/zapp-react-native-ui-components/Contexts", () => ({
|
|
74
|
+
...jest.requireActual(
|
|
75
|
+
"@applicaster/zapp-react-native-ui-components/Contexts"
|
|
76
|
+
),
|
|
67
77
|
ZappPipesEntryContext: {
|
|
68
|
-
useZappPipesContext: () => [{},
|
|
78
|
+
useZappPipesContext: () => [{}, mockSetEntryContext],
|
|
69
79
|
},
|
|
70
80
|
}));
|
|
71
81
|
|
|
@@ -77,7 +87,7 @@ jest.mock("../../../logger", () => ({
|
|
|
77
87
|
log_debug: jest.fn(),
|
|
78
88
|
}));
|
|
79
89
|
|
|
80
|
-
//
|
|
90
|
+
// Required after the mocks above, so the hook binds to them.
|
|
81
91
|
const { useOpenSchemeHandler } = require("../useOpenSchemeHandler");
|
|
82
92
|
|
|
83
93
|
const getWrapper = (storeProps = {}) => {
|
|
@@ -116,7 +126,7 @@ function clearMocks() {
|
|
|
116
126
|
navigator.replace.mockClear();
|
|
117
127
|
navigator.push.mockClear();
|
|
118
128
|
navigator.goHome.mockClear();
|
|
119
|
-
|
|
129
|
+
mockSetEntryContext.mockClear();
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
describe("useOpenSchemeHandler", () => {
|
|
@@ -230,7 +240,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
230
240
|
})
|
|
231
241
|
);
|
|
232
242
|
|
|
233
|
-
expect(
|
|
243
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
234
244
|
expect.objectContaining({
|
|
235
245
|
...params,
|
|
236
246
|
extensions: { ...params, initial_player_state: "fullscreen" },
|
|
@@ -287,7 +297,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
287
297
|
})
|
|
288
298
|
);
|
|
289
299
|
|
|
290
|
-
expect(
|
|
300
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
291
301
|
expect.objectContaining({
|
|
292
302
|
...params,
|
|
293
303
|
extensions: { ...params, initial_player_state: "fullscreen" },
|
|
@@ -346,7 +356,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
346
356
|
})
|
|
347
357
|
);
|
|
348
358
|
|
|
349
|
-
expect(
|
|
359
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
350
360
|
entryWithInitialPlayerState
|
|
351
361
|
);
|
|
352
362
|
};
|
|
@@ -376,7 +386,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
376
386
|
})
|
|
377
387
|
);
|
|
378
388
|
|
|
379
|
-
expect(
|
|
389
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
380
390
|
entryWithInitialPlayerState
|
|
381
391
|
);
|
|
382
392
|
};
|
|
@@ -406,7 +416,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
406
416
|
})
|
|
407
417
|
);
|
|
408
418
|
|
|
409
|
-
expect(
|
|
419
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
410
420
|
entryWithInitialPlayerState
|
|
411
421
|
);
|
|
412
422
|
};
|
|
@@ -436,7 +446,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
436
446
|
})
|
|
437
447
|
);
|
|
438
448
|
|
|
439
|
-
expect(
|
|
449
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
440
450
|
entryWithInitialPlayerState
|
|
441
451
|
);
|
|
442
452
|
};
|
|
@@ -466,7 +476,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
466
476
|
})
|
|
467
477
|
);
|
|
468
478
|
|
|
469
|
-
expect(
|
|
479
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
470
480
|
entryWithInitialPlayerState
|
|
471
481
|
);
|
|
472
482
|
};
|
|
@@ -500,7 +510,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
500
510
|
})
|
|
501
511
|
);
|
|
502
512
|
|
|
503
|
-
expect(
|
|
513
|
+
expect(mockSetEntryContext).toHaveBeenCalledWith(
|
|
504
514
|
expect.objectContaining(entryWithInitialPlayerState)
|
|
505
515
|
);
|
|
506
516
|
};
|
|
@@ -529,7 +539,7 @@ describe("useOpenSchemeHandler", () => {
|
|
|
529
539
|
);
|
|
530
540
|
|
|
531
541
|
expect(navigator.goHome).toHaveBeenCalled();
|
|
532
|
-
expect(
|
|
542
|
+
expect(mockSetEntryContext).not.toHaveBeenCalled();
|
|
533
543
|
};
|
|
534
544
|
|
|
535
545
|
await testHook({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/quick-brick-core",
|
|
3
|
-
"version": "15.1.
|
|
3
|
+
"version": "15.1.8",
|
|
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": "15.1.
|
|
32
|
-
"@applicaster/quick-brick-core-plugins": "15.1.
|
|
33
|
-
"@applicaster/zapp-pipes-v2-client": "15.1.
|
|
34
|
-
"@applicaster/zapp-react-native-bridge": "15.1.
|
|
35
|
-
"@applicaster/zapp-react-native-redux": "15.1.
|
|
36
|
-
"@applicaster/zapp-react-native-ui-components": "15.1.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "15.1.
|
|
31
|
+
"@applicaster/applicaster-types": "15.1.8",
|
|
32
|
+
"@applicaster/quick-brick-core-plugins": "15.1.8",
|
|
33
|
+
"@applicaster/zapp-pipes-v2-client": "15.1.8",
|
|
34
|
+
"@applicaster/zapp-react-native-bridge": "15.1.8",
|
|
35
|
+
"@applicaster/zapp-react-native-redux": "15.1.8",
|
|
36
|
+
"@applicaster/zapp-react-native-ui-components": "15.1.8",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "15.1.8",
|
|
38
38
|
"atob": "^2.1.2",
|
|
39
39
|
"axios": "^0.28.0",
|
|
40
40
|
"btoa": "^1.2.1",
|