add async mock capability.. fixes #26

This commit is contained in:
Lloyd Brookes
2015-12-13 13:02:48 +00:00
parent 7ca0da3d85
commit 5350186614
4 changed files with 47 additions and 2 deletions

View File

@ -0,0 +1,8 @@
{
"mocks": [
{
"route": "/",
"module": "/mocks/delayed.js"
}
]
}

View File

@ -0,0 +1,10 @@
module.exports = {
response: function (ctx) {
return new Promise((resolve, reject) => {
setTimeout(() => {
ctx.body = `<h1>You waited 2s for this</h1>`
resolve()
}, 2000)
})
}
}