RouteLocationRaw,
START_LOCATION_NORMALIZED,
} from '../src/types'
+import { mockWarn } from 'jest-mock-warn'
+
+declare var __DEV__: boolean
const routes: RouteRecordRaw[] = [
{ path: '/', component: components.Home, name: 'home' },
expect(() => router.resolve({ name: 'r2', params: {} })).not.toThrow()
})
+ describe('Warnings', () => {
+ mockWarn()
+
+ it.skip('avoid infinite redirection loops', async () => {
+ const history = createMemoryHistory()
+ let calls = 0
+ const beforeEnter = jest.fn((to, from, next) => {
+ if (++calls > 1000) throw new Error('1000 calls')
+ next(to.path)
+ })
+ console.log('dev', __DEV__)
+ const { router } = await newRouter({
+ history,
+ routes: [{ path: '/foo', component: components.Home, beforeEnter }],
+ })
+ await expect(router.push('/foo')).resolves.toBe(undefined)
+ })
+
+ it.todo('avoid infinite redirection loops when doing router.back()')
+
+ it.todo('warns if `next` is called twice')
+ })
+
describe('alias', () => {
it('does not navigate to alias if already on original record', async () => {
const { router } = await newRouter()