--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Router Matcher resolve LocationAsName throws if the named route does not exists 1`] = `[NoRouteMatchError: No match for {"path":"/","name":"Home","params":{},"query":{},"hash":"","fullPath":"/"}]`;
+
+exports[`Router Matcher resolve LocationAsPath throws if the path does not exists 1`] = `[NoRouteMatchError: No match for {"path":"/foo","params":{},"query":{},"hash":"","fullPath":"/"}]`;
+
+exports[`Router Matcher resolve LocationAsRelative redirects throws if relative location when redirecting 1`] = `
+[InvalidRouteMatch: Cannot redirect using a relative location:
+{
+ "params": {}
+}
+Use the function redirect and explicitely provide a name]
+`;
+
+exports[`Router Matcher resolve LocationAsRelative throws if the current named route does not exists 1`] = `[NoRouteMatchError: No match for {"name":"home","params":{},"path":"/"}]`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`RouterLink displays a link with a string prop 1`] = `"<a href=\\"/home\\">a link</a>"`;
+
+exports[`RouterLink displays a link with an object with path prop 1`] = `"<a href=\\"/home\\">a link</a>"`;
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`RouterView displays current route component 1`] = `"<div>Home</div>"`;
+
+exports[`RouterView displays deeply nested views 1`] = `"<div><h2>Nested</h2><div><h2>Nested</h2><div>Foo</div></div></div>"`;
+
+exports[`RouterView displays named views 1`] = `"<div>Foo</div>"`;
+
+exports[`RouterView displays nested views 1`] = `"<div><h2>Nested</h2><div>Foo</div></div>"`;
+
+exports[`RouterView displays nothing when route is unmatched 1`] = `undefined`;
it('throws if the path does not exists', () => {
expect(
assertErrorMatch({ path: '/', components }, { path: '/foo' })
- ).toMatchInlineSnapshot(
- `[NoRouteMatchError: No match for {"path":"/foo","params":{},"query":{},"hash":"","fullPath":"/"}]`
- )
+ ).toMatchSnapshot()
})
})
it('throws if the named route does not exists', () => {
expect(
assertErrorMatch({ path: '/', components }, { name: 'Home' })
- ).toMatchInlineSnapshot(
- `[NoRouteMatchError: No match for {"path":"/","name":"Home","params":{},"query":{},"hash":"","fullPath":"/"}]`
- )
+ ).toMatchSnapshot()
})
})
meta: {},
}
)
- ).toMatchInlineSnapshot(`
- [InvalidRouteMatch: Cannot redirect using a relative location:
- {
- "params": {}
- }
- Use the function redirect and explicitely provide a name]
- `)
+ ).toMatchSnapshot()
})
it('normalize a location when redirecting', () => {
meta: {},
}
)
- ).toMatchInlineSnapshot(
- `[NoRouteMatchError: No match for {"name":"home","params":{},"path":"/"}]`
- )
+ ).toMatchSnapshot()
})
})
{ to: locations.basic.string },
locations.basic.normalized
)
- expect(wrapper.html()).toMatchInlineSnapshot(
- `"<a href=\\"/home\\">a link</a>"`
- )
+ expect(wrapper.html()).toMatchSnapshot()
})
it('displays a link with an object with path prop', () => {
{ to: { path: locations.basic.string } },
locations.basic.normalized
)
- expect(wrapper.html()).toMatchInlineSnapshot(
- `"<a href=\\"/home\\">a link</a>"`
- )
+ expect(wrapper.html()).toMatchSnapshot()
})
it('calls ensureLocation', () => {
it('displays current route component', async () => {
const wrapper = factory(routes.root)
- expect(wrapper.html()).toMatchInlineSnapshot(`"<div>Home</div>"`)
+ expect(wrapper.html()).toMatchSnapshot()
})
it('displays named views', async () => {
const wrapper = factory(routes.named, { name: 'foo' })
- expect(wrapper.html()).toMatchInlineSnapshot(`"<div>Foo</div>"`)
+ expect(wrapper.html()).toMatchSnapshot()
})
it('displays nothing when route is unmatched', async () => {
const wrapper = factory(START_LOCATION_NORMALIZED)
// NOTE: I wonder if this will stay stable in future releases
- expect(wrapper.html()).toMatchInlineSnapshot(`undefined`)
+ expect(wrapper.html()).toMatchSnapshot()
})
it('displays nested views', async () => {
const wrapper = factory(routes.nested)
- expect(wrapper.html()).toMatchInlineSnapshot(
- `"<div><h2>Nested</h2><div>Foo</div></div>"`
- )
+ expect(wrapper.html()).toMatchSnapshot()
})
it('displays deeply nested views', async () => {
const wrapper = factory(routes.nestedNested)
- expect(wrapper.html()).toMatchInlineSnapshot(
- `"<div><h2>Nested</h2><div><h2>Nested</h2><div>Foo</div></div></div>"`
- )
+ expect(wrapper.html()).toMatchSnapshot()
})
})
--- /dev/null
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`SSR: basicRenderer renders the view 1`] = `"<div data-server-rendered=\\"true\\"><div>Home</div></div>"`;
it('renders the view', async () => {
const app = await renderApp({ url: '/' })
const result = await renderer.renderToString(app)
- expect(result).toMatchInlineSnapshot(
- `"<div data-server-rendered=\\"true\\"><div>Home</div></div>"`
- )
+ expect(result).toMatchSnapshot()
})
/**