Skip to content

Commit 5835090

Browse files
committed
improve included route test case
1 parent 799dd50 commit 5835090

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

test/unit/specs/route.spec.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,17 @@ describe('Route utils', () => {
7676
})
7777

7878
it('trailing slash', () => {
79-
const a = { path: 'user/1' }
80-
const b = { path: 'user/10' }
81-
const c = { path: 'user/10/' }
82-
const d = { path: 'user/1/' }
79+
const a = { path: '/users' }
80+
const b = { path: '/user' }
81+
const c = { path: '/users/' }
8382
expect(isIncludedRoute(a, b)).toBe(false)
84-
expect(isIncludedRoute(a, c)).toBe(false)
85-
expect(isIncludedRoute(b, d)).toBe(false)
86-
expect(isIncludedRoute(c, d)).toBe(false)
83+
expect(isIncludedRoute(a, c)).toBe(true)
84+
85+
const d = { path: '/users/hello/world' }
86+
const e = { path: '/users/hello' }
87+
const f = { path: '/users/hello-world' }
88+
expect(isIncludedRoute(d, e)).toBe(true)
89+
expect(isIncludedRoute(d, f)).toBe(false)
8790
})
8891
})
8992
})

0 commit comments

Comments
 (0)