@tramvai/test-mocks 3.25.5 → 3.26.2
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/lib/router.d.ts +2 -2
- package/lib/router.es.js +11 -5
- package/lib/router.js +11 -5
- package/package.json +7 -7
package/lib/router.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Route } from '@tinkoff/router';
|
|
1
|
+
import type { Route, NavigationRoute } from '@tinkoff/router';
|
|
2
2
|
import { AbstractRouter } from '@tinkoff/router';
|
|
3
3
|
import type { Url } from '@tinkoff/url';
|
|
4
4
|
interface Options {
|
|
5
|
-
currentRoute?: Route;
|
|
5
|
+
currentRoute?: Route | NavigationRoute;
|
|
6
6
|
currentUrl?: Url;
|
|
7
7
|
}
|
|
8
8
|
export declare const createMockRouter: ({ currentRoute, currentUrl, }?: Options) => AbstractRouter;
|
package/lib/router.es.js
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { AbstractRouter } from '@tinkoff/router';
|
|
2
2
|
import { parse } from '@tinkoff/url';
|
|
3
3
|
|
|
4
|
+
const isNavigationRoute = (route) => {
|
|
5
|
+
return (route.actualPath !== undefined &&
|
|
6
|
+
route.params !== undefined);
|
|
7
|
+
};
|
|
4
8
|
const createMockRouter = ({ currentRoute = { name: 'root', path: '/' }, currentUrl = parse(currentRoute.path), } = {}) => {
|
|
5
|
-
let route =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
let route = isNavigationRoute(currentRoute)
|
|
10
|
+
? currentRoute
|
|
11
|
+
: {
|
|
12
|
+
params: {},
|
|
13
|
+
actualPath: currentRoute.path,
|
|
14
|
+
...currentRoute,
|
|
15
|
+
};
|
|
10
16
|
let url = currentUrl;
|
|
11
17
|
let blocked = false;
|
|
12
18
|
return new (class extends AbstractRouter {
|
package/lib/router.js
CHANGED
|
@@ -5,12 +5,18 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var router = require('@tinkoff/router');
|
|
6
6
|
var url = require('@tinkoff/url');
|
|
7
7
|
|
|
8
|
+
const isNavigationRoute = (route) => {
|
|
9
|
+
return (route.actualPath !== undefined &&
|
|
10
|
+
route.params !== undefined);
|
|
11
|
+
};
|
|
8
12
|
const createMockRouter = ({ currentRoute = { name: 'root', path: '/' }, currentUrl = url.parse(currentRoute.path), } = {}) => {
|
|
9
|
-
let route =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
let route = isNavigationRoute(currentRoute)
|
|
14
|
+
? currentRoute
|
|
15
|
+
: {
|
|
16
|
+
params: {},
|
|
17
|
+
actualPath: currentRoute.path,
|
|
18
|
+
...currentRoute,
|
|
19
|
+
};
|
|
14
20
|
let url = currentUrl;
|
|
15
21
|
let blocked = false;
|
|
16
22
|
return new (class extends router.AbstractRouter {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/test-mocks",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"watch": "tsc -w"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@tramvai/core": "3.
|
|
20
|
+
"@tramvai/core": "3.26.2",
|
|
21
21
|
"@tinkoff/pubsub": "0.6.1",
|
|
22
|
-
"@tinkoff/router": "0.3.
|
|
22
|
+
"@tinkoff/router": "0.3.45",
|
|
23
23
|
"@tinkoff/url": "0.9.2",
|
|
24
|
-
"@tramvai/module-cookie": "3.
|
|
25
|
-
"@tramvai/module-common": "3.
|
|
26
|
-
"@tramvai/state": "3.
|
|
27
|
-
"@tramvai/tokens-common": "3.
|
|
24
|
+
"@tramvai/module-cookie": "3.26.2",
|
|
25
|
+
"@tramvai/module-common": "3.26.2",
|
|
26
|
+
"@tramvai/state": "3.26.2",
|
|
27
|
+
"@tramvai/tokens-common": "3.26.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@tinkoff/dippy": "0.9.2",
|