@dr.pogodin/react-utils 1.38.1 → 1.39.1
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/build/development/index.js +0 -9
- package/build/development/index.js.map +1 -1
- package/build/development/shared/components/Button/index.js +3 -3
- package/build/development/shared/components/Button/index.js.map +1 -1
- package/build/development/shared/components/Input/index.js +2 -0
- package/build/development/shared/components/Input/index.js.map +1 -1
- package/build/development/shared/components/Modal/index.js +1 -1
- package/build/development/shared/components/Modal/index.js.map +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js +1 -1
- package/build/development/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/development/shared/components/selectors/common.js.map +1 -1
- package/build/development/shared/utils/jest/index.js +34 -0
- package/build/development/shared/utils/jest/index.js.map +1 -1
- package/build/development/style.css +25 -25
- package/build/development/web.bundle.js +20 -30
- package/build/production/index.js +1 -1
- package/build/production/index.js.map +1 -1
- package/build/production/shared/components/Button/index.js +1 -1
- package/build/production/shared/components/Button/index.js.map +1 -1
- package/build/production/shared/components/Input/index.js +1 -1
- package/build/production/shared/components/Input/index.js.map +1 -1
- package/build/production/shared/components/Modal/index.js +1 -1
- package/build/production/shared/components/Modal/index.js.map +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js +1 -1
- package/build/production/shared/components/selectors/NativeDropdown/index.js.map +1 -1
- package/build/production/shared/components/selectors/common.js.map +1 -1
- package/build/production/shared/utils/jest/index.js +3 -2
- package/build/production/shared/utils/jest/index.js.map +1 -1
- package/build/production/style.css +1 -1
- package/build/production/style.css.map +1 -1
- package/build/production/web.bundle.js +1 -1
- package/build/production/web.bundle.js.map +1 -1
- package/build/types-code/index.d.ts +0 -1
- package/build/types-code/shared/components/Input/index.d.ts +1 -0
- package/build/types-code/shared/components/selectors/common.d.ts +1 -1
- package/build/types-code/shared/utils/jest/index.d.ts +3 -0
- package/config/webpack/app-base.js +5 -0
- package/config/webpack/lib-base.js +5 -0
- package/package.json +22 -21
- package/src/index.ts +0 -2
- package/src/shared/components/Button/index.tsx +6 -3
- package/src/shared/components/Input/index.tsx +3 -0
- package/src/shared/components/Modal/base-theme.scss +2 -2
- package/src/shared/components/Modal/index.tsx +1 -1
- package/src/shared/components/Throbber/theme.scss +5 -5
- package/src/shared/components/selectors/NativeDropdown/index.tsx +1 -1
- package/src/shared/components/selectors/common.ts +1 -1
- package/src/shared/utils/jest/index.tsx +53 -0
- package/src/styles/mixins.scss +3 -1
|
@@ -2,7 +2,6 @@ import 'styles/global.scss';
|
|
|
2
2
|
import type ServerT from './server';
|
|
3
3
|
declare const server: (typeof ServerT) | null;
|
|
4
4
|
declare const client: any;
|
|
5
|
-
export { default as api } from 'axios';
|
|
6
5
|
export { type AsyncCollectionLoaderT, type AsyncDataEnvelopeT, type AsyncDataLoaderT, type ForceT, type UseAsyncDataOptionsT, type UseAsyncDataResT, type UseGlobalStateResT, type ValueOrInitializerT, getGlobalState, GlobalStateProvider, newAsyncDataEnvelope, useAsyncCollection, useAsyncData, useGlobalState, withGlobalStateType, } from '@dr.pogodin/react-global-state';
|
|
7
6
|
export * from './shared/components';
|
|
8
7
|
export { type Listener, type Theme, config, Barrier, Emitter, isomorphy, getSsrContext, Semaphore, splitComponent, themed, ThemeProvider, time, webpack, withRetries, } from './shared/utils';
|
|
@@ -2,6 +2,7 @@ import { type Theme } from '@dr.pogodin/react-themes';
|
|
|
2
2
|
type ThemeKeyT = 'container' | 'input' | 'label';
|
|
3
3
|
declare const _default: import("@dr.pogodin/react-themes").ThemedComponent<React.InputHTMLAttributes<HTMLInputElement> & {
|
|
4
4
|
label?: React.ReactNode;
|
|
5
|
+
testId?: string;
|
|
5
6
|
theme: Theme<ThemeKeyT>;
|
|
6
7
|
} & React.RefAttributes<HTMLInputElement>>;
|
|
7
8
|
export default _default;
|
|
@@ -10,7 +10,7 @@ export type PropsT<NameT, OnChangeT = React.ChangeEventHandler<HTMLSelectElement
|
|
|
10
10
|
filter?: (item: OptionT<NameT> | ValueT) => boolean;
|
|
11
11
|
label?: React.ReactNode;
|
|
12
12
|
onChange?: OnChangeT;
|
|
13
|
-
options
|
|
13
|
+
options: Readonly<OptionsT<NameT>>;
|
|
14
14
|
testId?: string;
|
|
15
15
|
theme: Theme<ThemeKeyT>;
|
|
16
16
|
value?: ValueT;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
1
2
|
import { type ReactNode, act } from 'react';
|
|
2
3
|
import { type RenderResult } from '@testing-library/react';
|
|
3
4
|
/**
|
|
@@ -25,6 +26,8 @@ export declare function unmockClientSide(): void;
|
|
|
25
26
|
* @return {string}
|
|
26
27
|
*/
|
|
27
28
|
export declare function getMockUuid(seed?: number): string;
|
|
29
|
+
export type AxiosRequestHandlerT = (config: AxiosRequestConfig) => Partial<AxiosResponse> | null | undefined;
|
|
30
|
+
export declare function mockAxios(handlers: AxiosRequestHandlerT[]): any;
|
|
28
31
|
/**
|
|
29
32
|
* Advances mock timers, and mock date by the specified time.
|
|
30
33
|
* @param {number} time Time step [ms].
|
|
@@ -258,6 +258,11 @@ function configFactory(ops) {
|
|
|
258
258
|
generator: {
|
|
259
259
|
filename: 'fonts/[contenthash][ext][query]',
|
|
260
260
|
},
|
|
261
|
+
}, {
|
|
262
|
+
// Aggregates source maps from dependencies.
|
|
263
|
+
test: /\.js$/,
|
|
264
|
+
enforce: 'pre',
|
|
265
|
+
use: ['source-map-loader'],
|
|
261
266
|
}, {
|
|
262
267
|
/* Loads JS and JSX moudles, and inlines SVG assets. */
|
|
263
268
|
test: ops.typescript ? /\.((j|t)sx?|svg)$/ : /\.(jsx?|svg)$/,
|
|
@@ -74,6 +74,11 @@ function configFactory(ops) {
|
|
|
74
74
|
filename: '../shared/[path][name][ext]',
|
|
75
75
|
publicPath: `${ops.library}/build/shared`,
|
|
76
76
|
},
|
|
77
|
+
}, {
|
|
78
|
+
// Aggregates source maps from dependencies.
|
|
79
|
+
test: /\.js$/,
|
|
80
|
+
enforce: 'pre',
|
|
81
|
+
use: ['source-map-loader'],
|
|
77
82
|
}, {
|
|
78
83
|
/* Loads JS and JSX moudles, and inlines SVG assets. */
|
|
79
84
|
test: ops.typescript ? /\.((j|t)sx?|svg)$/ : /\.(jsx?|svg)$/,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.39.1",
|
|
3
3
|
"bin": {
|
|
4
4
|
"react-utils-build": "bin/build.js",
|
|
5
5
|
"react-utils-setup": "bin/setup.js"
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://github.com/birdofpreyru/react-utils/issues"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@babel/runtime": "^7.24.
|
|
11
|
+
"@babel/runtime": "^7.24.8",
|
|
12
12
|
"@dr.pogodin/babel-plugin-react-css-modules": "^6.13.2",
|
|
13
13
|
"@dr.pogodin/csurf": "^1.13.0",
|
|
14
14
|
"@dr.pogodin/js-utils": "^0.0.12",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"cookie": "^0.6.0",
|
|
23
23
|
"cookie-parser": "^1.4.6",
|
|
24
24
|
"cross-env": "^7.0.3",
|
|
25
|
-
"dayjs": "^1.11.
|
|
25
|
+
"dayjs": "^1.11.12",
|
|
26
26
|
"express": "^4.19.2",
|
|
27
27
|
"helmet": "^7.1.0",
|
|
28
28
|
"http-status-codes": "^2.3.0",
|
|
@@ -30,36 +30,36 @@
|
|
|
30
30
|
"lodash": "^4.17.21",
|
|
31
31
|
"morgan": "^1.10.0",
|
|
32
32
|
"node-forge": "^1.3.1",
|
|
33
|
-
"qs": "^6.12.
|
|
33
|
+
"qs": "^6.12.3",
|
|
34
34
|
"raf": "^3.4.1",
|
|
35
35
|
"react": "^18.3.1",
|
|
36
36
|
"react-dom": "^18.3.1",
|
|
37
37
|
"react-helmet": "^6.1.0",
|
|
38
|
-
"react-router-dom": "^6.
|
|
38
|
+
"react-router-dom": "^6.25.1",
|
|
39
39
|
"request-ip": "^3.3.0",
|
|
40
|
-
"rimraf": "^
|
|
40
|
+
"rimraf": "^6.0.0",
|
|
41
41
|
"serialize-javascript": "^6.0.2",
|
|
42
42
|
"serve-favicon": "^2.5.0",
|
|
43
43
|
"source-map-support": "^0.5.21",
|
|
44
44
|
"uuid": "^10.0.0",
|
|
45
|
-
"winston": "^3.13.
|
|
45
|
+
"winston": "^3.13.1"
|
|
46
46
|
},
|
|
47
47
|
"description": "Collection of generic ReactJS components and utils",
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@babel/cli": "^7.24.
|
|
50
|
-
"@babel/core": "^7.24.
|
|
51
|
-
"@babel/eslint-parser": "^7.24.
|
|
49
|
+
"@babel/cli": "^7.24.8",
|
|
50
|
+
"@babel/core": "^7.24.9",
|
|
51
|
+
"@babel/eslint-parser": "^7.24.8",
|
|
52
52
|
"@babel/eslint-plugin": "^7.24.7",
|
|
53
|
-
"@babel/node": "^7.24.
|
|
53
|
+
"@babel/node": "^7.24.8",
|
|
54
54
|
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
55
|
-
"@babel/preset-env": "^7.24.
|
|
55
|
+
"@babel/preset-env": "^7.24.8",
|
|
56
56
|
"@babel/preset-react": "^7.24.7",
|
|
57
57
|
"@babel/preset-typescript": "^7.24.7",
|
|
58
58
|
"@babel/register": "^7.24.6",
|
|
59
59
|
"@dr.pogodin/babel-plugin-transform-assets": "^1.2.2",
|
|
60
60
|
"@dr.pogodin/babel-preset-svgr": "^1.8.0",
|
|
61
61
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
62
|
-
"@testing-library/dom": "^10.3.
|
|
62
|
+
"@testing-library/dom": "^10.3.2",
|
|
63
63
|
"@testing-library/react": "^16.0.0",
|
|
64
64
|
"@testing-library/user-event": "^14.5.2",
|
|
65
65
|
"@tsconfig/recommended": "^1.0.7",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/csurf": "^1.11.5",
|
|
71
71
|
"@types/express": "^4.17.21",
|
|
72
72
|
"@types/jest": "^29.5.12",
|
|
73
|
-
"@types/lodash": "^4.17.
|
|
73
|
+
"@types/lodash": "^4.17.7",
|
|
74
74
|
"@types/morgan": "^1.9.9",
|
|
75
75
|
"@types/node-forge": "^1.3.11",
|
|
76
76
|
"@types/pretty": "^2.0.3",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"eslint-plugin-import": "^2.29.1",
|
|
98
98
|
"eslint-plugin-jest": "^28.6.0",
|
|
99
99
|
"eslint-plugin-jsx-a11y": "^6.9.0",
|
|
100
|
-
"eslint-plugin-react": "^7.
|
|
100
|
+
"eslint-plugin-react": "^7.35.0",
|
|
101
101
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
102
102
|
"identity-obj-proxy": "^3.0.0",
|
|
103
103
|
"jest": "^29.7.0",
|
|
@@ -113,19 +113,20 @@
|
|
|
113
113
|
"react-refresh": "^0.14.2",
|
|
114
114
|
"regenerator-runtime": "^0.14.1",
|
|
115
115
|
"resolve-url-loader": "^5.0.0",
|
|
116
|
-
"sass": "^1.77.
|
|
116
|
+
"sass": "^1.77.8",
|
|
117
117
|
"sass-loader": "^14.2.1",
|
|
118
118
|
"sitemap": "^8.0.0",
|
|
119
|
-
"
|
|
119
|
+
"source-map-loader": "^5.0.0",
|
|
120
|
+
"stylelint": "^16.7.0",
|
|
120
121
|
"stylelint-config-standard-scss": "^13.1.0",
|
|
121
122
|
"supertest": "^7.0.0",
|
|
122
123
|
"tsc-alias": "^1.8.10",
|
|
123
|
-
"tstyche": "^2.
|
|
124
|
+
"tstyche": "^2.1.0",
|
|
124
125
|
"typed-scss-modules": "^8.0.1",
|
|
125
126
|
"typescript": "^5.5.3",
|
|
126
|
-
"typescript-eslint": "^7.
|
|
127
|
-
"webpack": "^5.
|
|
128
|
-
"webpack-dev-middleware": "^7.
|
|
127
|
+
"typescript-eslint": "^7.16.1",
|
|
128
|
+
"webpack": "^5.93.0",
|
|
129
|
+
"webpack-dev-middleware": "^7.3.0",
|
|
129
130
|
"webpack-hot-middleware": "^2.26.1",
|
|
130
131
|
"webpack-merge": "^6.0.1",
|
|
131
132
|
"workbox-core": "^7.1.0",
|
package/src/index.ts
CHANGED
|
@@ -8,8 +8,6 @@ const server = webpack.requireWeak('./server', __dirname) as (typeof ServerT) |
|
|
|
8
8
|
|
|
9
9
|
const client = server ? undefined : require('./client').default;
|
|
10
10
|
|
|
11
|
-
export { default as api } from 'axios';
|
|
12
|
-
|
|
13
11
|
export {
|
|
14
12
|
type AsyncCollectionLoaderT,
|
|
15
13
|
type AsyncDataEnvelopeT,
|
|
@@ -42,7 +42,10 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
42
42
|
if (disabled) {
|
|
43
43
|
if (theme.disabled) className += ` ${theme.disabled}`;
|
|
44
44
|
return (
|
|
45
|
-
<div
|
|
45
|
+
<div
|
|
46
|
+
className={className}
|
|
47
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
48
|
+
>
|
|
46
49
|
{children}
|
|
47
50
|
</div>
|
|
48
51
|
);
|
|
@@ -51,7 +54,7 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
51
54
|
return (
|
|
52
55
|
<Link
|
|
53
56
|
className={className}
|
|
54
|
-
data-testid={testId}
|
|
57
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
55
58
|
enforceA={enforceA}
|
|
56
59
|
onClick={onClick}
|
|
57
60
|
onMouseDown={onMouseDown}
|
|
@@ -67,7 +70,7 @@ export const BaseButton: React.FunctionComponent<PropsT> = ({
|
|
|
67
70
|
return (
|
|
68
71
|
<div
|
|
69
72
|
className={className}
|
|
70
|
-
data-testid={testId}
|
|
73
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
71
74
|
onClick={onClick}
|
|
72
75
|
onKeyDown={onClick && ((e) => {
|
|
73
76
|
if (e.key === 'Enter') onClick(e);
|
|
@@ -11,6 +11,7 @@ type ThemeKeyT =
|
|
|
11
11
|
|
|
12
12
|
type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
13
13
|
label?: React.ReactNode;
|
|
14
|
+
testId?: string;
|
|
14
15
|
theme: Theme<ThemeKeyT>;
|
|
15
16
|
};
|
|
16
17
|
|
|
@@ -26,6 +27,7 @@ type PropsT = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
|
26
27
|
const Input = forwardRef<HTMLInputElement, PropsT>((
|
|
27
28
|
{
|
|
28
29
|
label,
|
|
30
|
+
testId,
|
|
29
31
|
theme,
|
|
30
32
|
...rest
|
|
31
33
|
}: PropsT,
|
|
@@ -35,6 +37,7 @@ const Input = forwardRef<HTMLInputElement, PropsT>((
|
|
|
35
37
|
{ label === undefined ? null : <div className={theme.label}>{label}</div> }
|
|
36
38
|
<input
|
|
37
39
|
className={theme.input}
|
|
40
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
38
41
|
ref={ref}
|
|
39
42
|
{...rest} // eslint-disable-line react/jsx-props-no-spreading
|
|
40
43
|
/>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
position: fixed;
|
|
12
12
|
top: 0;
|
|
13
13
|
width: 100%;
|
|
14
|
-
z-index:
|
|
14
|
+
z-index: $zIndexOfDefaultModalOverlay;
|
|
15
15
|
|
|
16
16
|
&:focus { outline: none; }
|
|
17
17
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
top: 50%;
|
|
30
30
|
left: 50%;
|
|
31
31
|
transform: translate(-50%, -50%);
|
|
32
|
-
z-index:
|
|
32
|
+
z-index: $zIndexOfDefaultModalOverlay + 1;
|
|
33
33
|
|
|
34
34
|
@include xs-to-lg {
|
|
35
35
|
max-width: 95vw;
|
|
@@ -147,7 +147,7 @@ const BaseModal: React.FunctionComponent<PropsT> = ({
|
|
|
147
147
|
<div
|
|
148
148
|
aria-modal="true"
|
|
149
149
|
className={theme.container}
|
|
150
|
-
data-testid={testId}
|
|
150
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
151
151
|
onClick={(e) => e.stopPropagation()}
|
|
152
152
|
onWheel={(event) => event.stopPropagation()}
|
|
153
153
|
ref={containerRef}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
@keyframes bouncing {
|
|
2
|
+
from { top: -0.3em; }
|
|
3
|
+
to { top: 0.3em; }
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
*,
|
|
2
7
|
.context,
|
|
3
8
|
.ad.hoc {
|
|
@@ -6,11 +11,6 @@
|
|
|
6
11
|
}
|
|
7
12
|
|
|
8
13
|
&.circle {
|
|
9
|
-
@keyframes bouncing {
|
|
10
|
-
from { top: -0.3em; }
|
|
11
|
-
to { top: 0.3em; }
|
|
12
|
-
}
|
|
13
|
-
|
|
14
14
|
animation: bouncing 0.4s ease-in infinite alternate;
|
|
15
15
|
background: black;
|
|
16
16
|
border-radius: 0.3em;
|
|
@@ -76,7 +76,7 @@ const Dropdown: React.FunctionComponent<PropsT<string>> = ({
|
|
|
76
76
|
<div className={theme.dropdown}>
|
|
77
77
|
<select
|
|
78
78
|
className={selectClassName}
|
|
79
|
-
data-testid={testId}
|
|
79
|
+
data-testid={process.env.NODE_ENV === 'production' ? undefined : testId}
|
|
80
80
|
onChange={onChange}
|
|
81
81
|
value={value}
|
|
82
82
|
>
|
|
@@ -37,7 +37,7 @@ export type PropsT<
|
|
|
37
37
|
filter?: (item: OptionT<NameT> | ValueT) => boolean;
|
|
38
38
|
label?: React.ReactNode;
|
|
39
39
|
onChange?: OnChangeT;
|
|
40
|
-
options
|
|
40
|
+
options: Readonly<OptionsT<NameT>>;
|
|
41
41
|
testId?: string;
|
|
42
42
|
theme: Theme<ThemeKeyT>;
|
|
43
43
|
value?: ValueT;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/* global jest, document */
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies */
|
|
3
3
|
|
|
4
|
+
import type {
|
|
5
|
+
AxiosRequestConfig,
|
|
6
|
+
AxiosResponse,
|
|
7
|
+
InternalAxiosRequestConfig,
|
|
8
|
+
} from 'axios';
|
|
9
|
+
|
|
4
10
|
import mockdate from 'mockdate';
|
|
5
11
|
import { type ReactNode, act } from 'react';
|
|
6
12
|
import { type Root, createRoot } from 'react-dom/client';
|
|
@@ -53,6 +59,53 @@ export function getMockUuid(seed = 0) {
|
|
|
53
59
|
return `${x.slice(0, 8)}-${x.slice(8, 12)}-${x.slice(12, 16)}-${x.slice(16, 20)}-${x.slice(20)}`;
|
|
54
60
|
}
|
|
55
61
|
|
|
62
|
+
export type AxiosRequestHandlerT =
|
|
63
|
+
(config: AxiosRequestConfig) => Partial<AxiosResponse> | null | undefined;
|
|
64
|
+
|
|
65
|
+
export function mockAxios(handlers: AxiosRequestHandlerT[]) {
|
|
66
|
+
const axios = jest.requireActual('axios');
|
|
67
|
+
|
|
68
|
+
axios.defaults.adapter = async (config: AxiosRequestConfig): Promise<AxiosResponse> => {
|
|
69
|
+
for (let i = 0; i < handlers.length; ++i) {
|
|
70
|
+
const res = handlers[i]?.(config);
|
|
71
|
+
if (res) {
|
|
72
|
+
return {
|
|
73
|
+
config: config as InternalAxiosRequestConfig,
|
|
74
|
+
data: null,
|
|
75
|
+
headers: {},
|
|
76
|
+
status: 200,
|
|
77
|
+
statusText: 'OK',
|
|
78
|
+
...res,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Fallback to the regular network request.
|
|
84
|
+
let res: AxiosResponse;
|
|
85
|
+
try {
|
|
86
|
+
res = await axios({ ...config, adapter: ['xhr', 'http', 'fetch'] });
|
|
87
|
+
console.warn(
|
|
88
|
+
'Network request has not been mocked for a test.\n\nConfig:\n',
|
|
89
|
+
config,
|
|
90
|
+
'\n\nResult:\n',
|
|
91
|
+
JSON.stringify(res, null, 2),
|
|
92
|
+
);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
console.warn(
|
|
95
|
+
'Network request has not been mocked for a test, and failed.\n\nConfig:\n',
|
|
96
|
+
config,
|
|
97
|
+
'\n\nError\n',
|
|
98
|
+
JSON.stringify(e, null, 2),
|
|
99
|
+
);
|
|
100
|
+
throw e;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return res;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return axios;
|
|
107
|
+
}
|
|
108
|
+
|
|
56
109
|
/**
|
|
57
110
|
* Advances mock timers, and mock date by the specified time.
|
|
58
111
|
* @param {number} time Time step [ms].
|