Identify js and html route clashes

This commit is contained in:
mrkishi
2018-01-20 01:34:57 -02:00
parent a6dc61a182
commit 8a8526d9ed
2 changed files with 5 additions and 1 deletions

View File

@@ -78,7 +78,7 @@ module.exports = function create_matchers(files) {
const b_is_dynamic = b_part[0] === '['; const b_is_dynamic = b_part[0] === '[';
if (a_is_dynamic === b_is_dynamic) { if (a_is_dynamic === b_is_dynamic) {
if (!a_is_dynamic) same = false; if (!a_is_dynamic && a_part !== b_part) same = false;
continue; continue;
} }

View File

@@ -70,6 +70,10 @@ describe('create_routes', () => {
assert.throws(() => { assert.throws(() => {
create_routes(['[foo].html', '[bar]/index.html']); create_routes(['[foo].html', '[bar]/index.html']);
}, /The \[foo\].html and \[bar\]\/index.html routes clash/); }, /The \[foo\].html and \[bar\]\/index.html routes clash/);
assert.throws(() => {
create_routes(['foo.html', 'foo.js']);
}, /The foo.html and foo.js routes clash/);
}); });
it('matches nested routes', () => { it('matches nested routes', () => {