Comparing version 0.3.1 to 0.4.0
{ | ||
"name": "middl", | ||
"version": "0.3.1", | ||
"version": "0.4.0", | ||
"description": "A generic middleware library, inspired by Express and suitable for anything", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -36,3 +36,3 @@ 'use strict'; | ||
function app(input, output) { | ||
return run(input, output); | ||
return app.run(input, output); | ||
} | ||
@@ -39,0 +39,0 @@ // attach public app api: |
@@ -494,1 +494,15 @@ import test from 'ava'; | ||
}); | ||
test('app.run() should be patchable', async t => { | ||
const app = middl(); | ||
const _run = app.run; | ||
app.run = (input, output) => { | ||
input.patched = true; | ||
return _run(input, output); | ||
}; | ||
app.use((input, output) => { | ||
output.val = input.patched ? 'patched' : 'not patched'; | ||
}); | ||
const result = await app({}, {}); | ||
t.is(result.val, 'patched'); | ||
}); |
30890
766