extend unittests, simplify API, update README, use npm5 and package-lock.json, add node7 to travis config

This commit is contained in:
Konstantin Pogorelov
2017-06-04 16:31:26 +02:00
parent 1cc588c2da
commit b8ba87009e
9 changed files with 1984 additions and 73 deletions

View File

@@ -4,25 +4,8 @@
const normalizePath = require('../src/normalizePath');
describe('normalizePath', () => {
it('returns original if disabled in opts', () => {
expect(
normalizePath({originalUrl: '/a/12345'}, {normalizePath: false})
).toBe('/a/12345');
});
it('returns run callback if configured', () => {
expect(
normalizePath(
{originalUrl: '/a/12345'},
{
normalizePath: req => req.originalUrl + '-ok'
}
)
).toBe('/a/12345-ok');
});
it('uses UrlValueParser by default', () => {
expect(normalizePath({originalUrl: '/a/12345'}))
expect(normalizePath({url: '/a/12345'}))
.toBe('/a/#val');
});
});