get tests passing

This commit is contained in:
Rich Harris
2018-05-04 17:19:39 -04:00
parent 210d03fb06
commit b525eb6480
3 changed files with 7 additions and 8 deletions

View File

@@ -47,7 +47,6 @@
"eslint": "^4.13.1",
"eslint-plugin-import": "^2.8.0",
"express": "^4.16.3",
"get-port": "^3.2.0",
"mocha": "^5.0.4",
"nightmare": "^3.0.0",
"npm-run-all": "^4.1.2",
@@ -60,7 +59,6 @@
"serve-static": "^1.13.2",
"svelte": "^2.4.4",
"svelte-loader": "^2.9.0",
"ts-node": "^6.0.2",
"typescript": "^2.8.3",
"walk-sync": "^0.3.2",
"webpack": "^4.1.0"

View File

@@ -23,6 +23,7 @@ export default function create_routes({ files } = { files: glob.sync('**/*.*', {
parts
};
})
.filter(Boolean)
.filter((a, index, array) => {
const found = array.slice(index + 1).find(b => a.base === b.base);
if (found) found.files.push(...a.files);

View File

@@ -20,11 +20,11 @@ describe('create_routes', () => {
file: 'foo.html'
}
]
]
)
});
it('encodes caharcters not allowed in path', () => {
]
)
});
it('encodes characters not allowed in path', () => {
const routes = create_routes({
files: [
'"',
@@ -178,7 +178,7 @@ describe('create_routes', () => {
});
assert.deepEqual(
routes.map(r => r.file),
routes.map(r => r.handlers[0].file),
['.well-known']
);
});