Testing Vue Routing
We have currently got an application that renders what is our blog home page or feed view.
Next, we should have post pages. To do this, we will use Vue Router, as covered in previous chapters, and ensure that our routing works as designed with unit tests.
Vue Router is installed using npm, specifically, npm install vue-router, and wiring it up in the main.js file:
// other imports
import router from './router'
// other imports and configuration
new Vue({
  render: h => h(App),
  router,
}).$mount(‹#app›)
The router.js file registers vue-router with Vue using Vue.use and instantiates a VueRouter instance:
import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
export default new VueRouter({})
A router with no routes isn't very useful. We'll define the root path (/) to display the PostList component in the router.js file, as follows:
// other imports...