]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: refactor types
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 6 May 2019 17:58:12 +0000 (19:58 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 6 May 2019 17:58:12 +0000 (19:58 +0200)
__tests__/guards/component-beforeRouteEnter.spec.js
__tests__/guards/component-beforeRouteLeave.spec.js

index 9f5a979fc44aefa7ed986f13674979f8f0c2a6fd..ac3b9170a5f4b465ee59073aa0ccbef4eb24ae51 100644 (file)
@@ -6,8 +6,11 @@ const { Router } = require('../../src/router')
 const fakePromise = require('faked-promise')
 const { NAVIGATION_TYPES, createDom, noGuard } = require('../utils')
 
+/** @typedef {import('../../src/types').RouteRecord} RouteRecord */
+/** @typedef {import('../../src/router').RouterOptions} RouterOptions */
+
 /**
- * @param {Partial<import('../../src/router').RouterOptions> & { routes: import('../../src/types').RouteRecord[]}} options
+ * @param {Partial<RouterOptions> & { routes: RouteRecord[]}} options
  */
 function createRouter(options) {
   return new Router({
@@ -24,6 +27,7 @@ const named = {
   default: jest.fn(),
   other: jest.fn(),
 }
+
 const nested = {
   parent: jest.fn(),
   nestedEmpty: jest.fn(),
@@ -33,7 +37,8 @@ const nested = {
   nestedNestedFoo: jest.fn(),
   nestedNestedParam: jest.fn(),
 }
-/** @type {import('../../src/types').RouteRecord[]} */
+
+/** @type {RouteRecord[]} */
 const routes = [
   { path: '/', component: Home },
   { path: '/foo', component: Foo },
index caab1a6ea3bee17c6ef7662fb4035a5048393935..cee6670ade44979744dcf612fa90e0d1382e784b 100644 (file)
@@ -4,10 +4,13 @@ const expect = require('expect')
 const { HTML5History } = require('../../src/history/html5')
 const { Router } = require('../../src/router')
 const fakePromise = require('faked-promise')
-const { NAVIGATION_TYPES, createDom } = require('../utils')
+const { NAVIGATION_TYPES, createDom, noGuard } = require('../utils')
+
+/** @typedef {import('../../src/types').RouteRecord} RouteRecord */
+/** @typedef {import('../../src/router').RouterOptions} RouterOptions */
 
 /**
- * @param {Partial<import('../../src/router').RouterOptions> & { routes: import('../../src/types').RouteRecord[]}} options
+ * @param {Partial<RouterOptions> & { routes: RouteRecord[]}} options
  */
 function createRouter(options) {
   return new Router({
@@ -20,7 +23,8 @@ const Home = { template: `<div>Home</div>` }
 const Foo = { template: `<div>Foo</div>` }
 
 const beforeRouteLeave = jest.fn()
-/** @type {import('../../src/types').RouteRecord[]} */
+
+/** @type {RouteRecord[]} */
 const routes = [
   { path: '/', component: Home },
   { path: '/foo', component: Foo },