Skip to content

Commit 0622af0

Browse files
committed
Comment out unused features (router)
1 parent adc63c6 commit 0622af0

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"vue-apollo": "^3.0.4",
7373
"vue-i18n": "^9.0.0-beta.4",
7474
"vue-jest": "^5.0.0-alpha.5",
75-
"vue-router": "^3.4.5",
75+
"vue-router": "^4.0.0-beta.13",
7676
"vuetify": "^2.3.10",
7777
"vuex": "^4.0.0-beta.4"
7878
},

src/__tests__/vue-router-mocha.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import '@testing-library/jest-dom'
2-
import {render} from '@testing-library/vue'
1+
test.todo('Your test suite must contain at least one test.')
32

4-
import About from './components/Router/About.vue'
3+
// import '@testing-library/jest-dom'
4+
// import {render} from '@testing-library/vue'
55

6-
const routes = []
7-
test('uses require("vue-router").default when require("vue-router") is undefined (useful for mocha users)', () => {
8-
// Test for fix https://github.com/testing-library/vue-testing-library/issues/119
9-
jest.mock('vue-router', () => {
10-
return undefined
11-
})
6+
// import About from './components/Router/About.vue'
127

13-
expect(() => render(About, {routes})).toThrowError(
14-
new TypeError("Cannot read property 'default' of undefined"),
15-
)
16-
})
8+
// const routes = []
9+
// test('uses require("vue-router").default when require("vue-router") is undefined (useful for mocha users)', () => {
10+
// // Test for fix https://github.com/testing-library/vue-testing-library/issues/119
11+
// jest.mock('vue-router', () => {
12+
// return undefined
13+
// })
14+
15+
// expect(() => render(About, {routes})).toThrowError(
16+
// new TypeError("Cannot read property 'default' of undefined"),
17+
// )
18+
// })

src/__tests__/vue-router.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
test.todo('Your test suite must contain at least one test.')
22

3+
// // Please notice that this example is a draft example on how to test
4+
// // the router.
5+
// // Related issue on Vue Test Utils: https://github.com/vuejs/vue-test-utils-next/issues/152
6+
37
// import '@testing-library/jest-dom'
48
// import {render, fireEvent} from '@testing-library/vue'
5-
69
// import App from './components/Router/App.vue'
710
// import Home from './components/Router/Home.vue'
811
// import About from './components/Router/About.vue'
912

1013
// const routes = [
1114
// {path: '/', component: Home},
1215
// {path: '/about', component: About},
13-
// {path: '*', redirect: '/about'},
1416
// ]
1517

1618
// test('full app rendering/navigating', async () => {

src/vue-testing-library.js

+13-17
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ function render(
1515
TestComponent,
1616
{
1717
store = null,
18-
routes = null,
18+
// routes = null,
1919
container: customContainer,
2020
baseElement: customBaseElement,
2121
...mountOptions
2222
} = {},
23-
configurationCb,
23+
// configurationCb,
2424
) {
2525
const div = document.createElement('div')
2626
const baseElement = customBaseElement || customContainer || document.body
2727
const container = customContainer || baseElement.appendChild(div)
2828

29-
let router = null
30-
let additionalOptions = {}
29+
// let additionalOptions = {}
3130

3231
const plugins = []
3332

@@ -36,30 +35,27 @@ function render(
3635
plugins.push(createStore(store))
3736
}
3837

39-
// TODO: Fix VTL + Vue-router(next?)
40-
if (routes) {
41-
const requiredRouter = require('vue-router')
42-
const VueRouter = requiredRouter.default || requiredRouter
43-
router = new VueRouter({
44-
routes,
45-
})
46-
}
38+
// if (routes) {
39+
// const requiredRouter = require('vue-router')
40+
// const {createRouter, createWebHistory} =
41+
// requiredRouter.default || requiredRouter
42+
// plugins.push(createRouter({history: createWebHistory(), routes}))
43+
// }
4744

4845
// Should we expose vue 3 app? if so, how?
49-
if (configurationCb && typeof configurationCb === 'function') {
50-
additionalOptions = configurationCb(router)
51-
}
46+
// if (configurationCb && typeof configurationCb === 'function') {
47+
// additionalOptions = configurationCb(router)
48+
// }
5249

5350
const wrapper = mount(
5451
TestComponent,
5552
merge({
56-
// router,
5753
attachTo: container,
5854
global: {
5955
plugins,
6056
},
6157
...mountOptions,
62-
...additionalOptions,
58+
// ...additionalOptions,
6359
}),
6460
)
6561

0 commit comments

Comments
 (0)