Skip to content

Commit

Permalink
test: update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
2nthony committed Jun 22, 2019
1 parent de2620e commit f3ccbdd
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 19 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ node_modules/
.DS_Store
/index.js
dist
test/snapshots
23 changes: 5 additions & 18 deletions test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,18 @@
import path from 'path'
import test from 'ava'
import {
renderRoutes,
collectRoutes,
renderRoutesMap
} from '../lib/collect-fs-routes'
import Plugin from '../lib/plugin'
import { renderRoutes, collectRoutes } from '../lib/collect-fs-routes'

const dir = path.join(__dirname, 'views')
const dir = 'test/views'
const options = {
dir,
match: 'vue,js'
}

test('main', async t => {
const routes = await collectRoutes(options)

const routesString = renderRoutes(routes)
const routesMap = renderRoutesMap(routes)
const routesString = renderRoutes(routes, {
componentPrefix: ''
})

t.snapshot(JSON.stringify(routes), 'collect routes')
t.snapshot(routesString, 'render routes')
t.snapshot(routesMap, 'render routes map')
})

test('plugin routes file', async t => {
const plugin = new Plugin(options)

t.snapshot(await plugin.handleRoutesString(), 'plugin routes file')
})
54 changes: 54 additions & 0 deletions test/snapshots/index.test.js.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Snapshot report for `test/index.test.js`

The actual snapshot is saved in `index.test.js.snap`.

Generated by [AVA](https://ava.li).

## main

> collect routes
'[{"path":"/","component":"test/views/index.vue"},{"path":"/bar","component":"test/views/bar/index.vue"},{"path":"/bar/:id","component":"test/views/bar/$id.vue"},{"path":"/foo","component":"test/views/foo/index.vue"},{"path":"/foo/:name","component":"test/views/foo/{name}.vue"}]'

> render routes
`␊
[␊
{␊
path: "/",␊
component: () => import(/* webpackChunkName: "page-test-views-index-vue" */ "test/views/index.vue"),␊
}␊
,␊
{␊
path: "/bar",␊
component: () => import(/* webpackChunkName: "page-test-views-bar-index-vue" */ "test/views/bar/index.vue"),␊
}␊
,␊
{␊
path: "/bar/:id",␊
component: () => import(/* webpackChunkName: "page-test-views-bar-$id-vue" */ "test/views/bar/$id.vue"),␊
}␊
,␊
{␊
path: "/foo",␊
component: () => import(/* webpackChunkName: "page-test-views-foo-index-vue" */ "test/views/foo/index.vue"),␊
}␊
,␊
{␊
path: "/foo/:name",␊
props: true,␊
component: () => import(/* webpackChunkName: "page-test-views-foo-{name}-vue" */ "test/views/foo/{name}.vue"),␊
}␊
]␊
`
Binary file added test/snapshots/index.test.js.snap
Binary file not shown.

0 comments on commit f3ccbdd

Please sign in to comment.