Skip to content

Commit e3a8931

Browse files
committed
fixing tests/unit/router/routes.spec.js
1 parent 27853e8 commit e3a8931

1 file changed

Lines changed: 8 additions & 13 deletions

File tree

tests/unit/router/routes.spec.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
1-
/* eslint-env jest */
2-
31
import RestClient from "@/lib/Client/RESTClient.js";
4-
import router, {
2+
import {
53
afterEach,
64
beforeEach,
5+
createMyRouter,
76
isLoggedIn,
87
isMaintenanceMode,
98
isNotLoggedIn,
109
isSuperCurator,
1110
scrollBehavior,
1211
} from "@/router";
13-
//import VueRouter from "vue-router";
14-
const sinon = require("sinon");
1512

16-
/*
17-
const testrouter = new VueRouter(),
18-
$testrouter = { push: vi.fn() };
19-
const $route = {
20-
path: '/some/path'
21-
}
22-
*/
13+
const sinon = require("sinon");
2314

2415
let store = {
2516
state: {
@@ -36,10 +27,12 @@ let store = {
3627
};
3728

3829
let restStub;
30+
let router;
3931

4032
describe("Routes", () => {
4133
beforeAll(() => {
4234
window.scrollTo = vi.fn();
35+
router = createMyRouter(store);
4336
restStub = sinon.stub(RestClient.prototype, "executeQuery");
4437
restStub.returns({
4538
data: {
@@ -71,7 +64,9 @@ describe("Routes", () => {
7164
}
7265
if (beforeEachTester.indexOf(route.name) > -1) {
7366
const next = vi.fn();
74-
route.beforeEnter({ path: {} }, undefined, next);
67+
if (route.beforeEnter) {
68+
route.beforeEnter({ path: {} }, undefined, next);
69+
}
7570
}
7671
});
7772
});

0 commit comments

Comments
 (0)