add async mock capability.. fixes #26
This commit is contained in:
		
							
								
								
									
										8
									
								
								example/mock-async/.local-web-server.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								example/mock-async/.local-web-server.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| { | ||||
|   "mocks": [ | ||||
|     { | ||||
|       "route": "/", | ||||
|       "module": "/mocks/delayed.js" | ||||
|     } | ||||
|   ] | ||||
| } | ||||
							
								
								
									
										10
									
								
								example/mock-async/mocks/delayed.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								example/mock-async/mocks/delayed.js
									
									
									
									
									
										Normal 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) | ||||
|     }) | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user