Skip to content

Commit

Permalink
test(resolve): empty string params
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Apr 24, 2023
1 parent 7e77e2b commit 0058eaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/router/__tests__/router.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,25 @@ describe('Router', () => {
expect(route2.path).toBe('/optional')
expect(route2.params).toEqual({})

// but keeps empty strings
const route3 = router.resolve({
name: 'optional',
params: { p: '' },
})
expect(route3.path).toBe('/optional')
expect(route3.params).toEqual({ p: '' })

await router.push({ name: 'optional', params: { p: null } })
expect(router.currentRoute.value.params).toEqual({})
await router.push({ name: 'optional', params: {} })
})

it('keeps empty strings', async () => {
const { router } = await newRouter()
const route1 = router.resolve({ name: 'optional', params: { p: '' } })
expect(route1.params).toEqual({ p: '' })
})

it('navigates to same route record but different query', async () => {
const { router } = await newRouter()
await router.push('/?q=1')
Expand Down

0 comments on commit 0058eaf

Please sign in to comment.