-import { createRouteMatcher } from '../src/matcher'
+import { createRouteMatcher, RouteMatcher } from '../src/matcher'
import { RegExpOptions } from 'path-to-regexp'
import { RouteComponent } from '../src/types'
return [pathOrCombined, options]
})
- /** @type {Array<RouteMatcher & { _options: RegExpOptions }>} */
- const matchers = normalizedPaths
+ const matchers: Array<
+ RouteMatcher & { _options: RegExpOptions }
+ > = normalizedPaths
.slice()
// Because sorting order is conserved, allows to mismatch order on
// routes with the same ranking
'/a', // also matches /A
])
})
+
+ it('ranks repeated params properly', () => {
+ checkPathOrder([
+ '/:a',
+ '/:a+',
+ '/:a?',
+ '/:a*',
+ // FIXME: this one should appear here but it appears before /:a*
+ // '/:a(.*)'
+ ])
+ })
})
/**
*
- * @param {RouteRecord | RouteRecord[]} record Record or records we are testing the matcher against
- * @param {MatcherLocation} location location we want to reolve against
- * @param {MatcherLocationNormalized} [start] Optional currentLocation used when resolving
- * @returns {any} error
+ * @param record Record or records we are testing the matcher against
+ * @param location location we want to reolve against
+ * @param [start] Optional currentLocation used when resolving
+ * @returns error
*/
function assertErrorMatch(
record: RouteRecord | RouteRecord[],
location: MatcherLocation,
start: MatcherLocationNormalized = START_LOCATION_NORMALIZED
- ) {
+ ): any {
try {
assertRecordMatch(record, location, {}, start)
} catch (error) {