@shopgate/pwa-core 7.30.0-alpha.8 → 7.30.0-alpha.9
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.
|
@@ -17,7 +17,9 @@ global.Headers = class Headers {};
|
|
|
17
17
|
// Create a mock for the fetch method.
|
|
18
18
|
const mockedFetchResponse = {};
|
|
19
19
|
let mockedFetch;
|
|
20
|
-
|
|
20
|
+
beforeAll(() => {
|
|
21
|
+
global.fetch = jest.fn(); // mock fetch globally
|
|
22
|
+
});
|
|
21
23
|
|
|
22
24
|
// Create a mock for the Event class.
|
|
23
25
|
const mockedEventCall = jest.fn();
|
|
@@ -42,13 +44,10 @@ let processResponseSpy;
|
|
|
42
44
|
* @param {boolean} throwError Whether the mocked fetch shall throw an error.
|
|
43
45
|
*/
|
|
44
46
|
const updateMockedFetch = (throwError = false) => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
mockedFetch = jest.fn().mockRejectedValue(new Error());
|
|
51
|
-
}
|
|
47
|
+
mockedFetch = throwError ? jest.fn().mockRejectedValue(new Error()) : jest.fn().mockResolvedValue({
|
|
48
|
+
json: () => mockedFetchResponse
|
|
49
|
+
});
|
|
50
|
+
global.fetch.mockImplementation((...args) => mockedFetch(...args));
|
|
52
51
|
};
|
|
53
52
|
describe('DevServerBridge', () => {
|
|
54
53
|
let instance;
|
|
@@ -10,7 +10,7 @@ jest.mock("../../helpers/logGroup", () => (...args) => mockLogGroup(args));
|
|
|
10
10
|
* @return {PipelineDependencies}
|
|
11
11
|
*/
|
|
12
12
|
const getInstance = () => {
|
|
13
|
-
const instance =
|
|
13
|
+
const instance = jest.requireActual("./index").default;
|
|
14
14
|
return instance;
|
|
15
15
|
};
|
|
16
16
|
describe('PipelineDependencies', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-core",
|
|
3
|
-
"version": "7.30.0-alpha.
|
|
3
|
+
"version": "7.30.0-alpha.9",
|
|
4
4
|
"description": "Core library for the Shopgate Connect PWA.",
|
|
5
5
|
"author": "Support <support@shopgate.com>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"crypto-js": "3.1.9-1",
|
|
19
19
|
"detector": "^2.5.0",
|
|
20
|
-
"isomorphic-fetch": "^2.2.1",
|
|
21
20
|
"lodash": "^4.17.21",
|
|
22
21
|
"mobile-detect": "^1.4.3"
|
|
23
22
|
}
|