smocks
smocks copied to clipboard
Stateful mock HTTP server using HAPI
After comment out it it is working. /Users/hguo/repo/react/react-demo-hank/node_modules/smocks/lib/variant-model.js:48 this.done(); ^ TypeError: this.done is not a function at Variant.respondWith (/Users/hguo/repo/react/react-demo-hank/node_modules/smocks/lib/variant-model.js:48:10) at Variant.respondWithFile (/Users/hguo/repo/react/react-demo-hank/node_modules/smocks/lib/variant-model.js:54:17) at Route.respondWithFile (/Users/hguo/repo/react/react-demo-hank/node_modules/smocks/lib/route-model.js:229:20) at Object. (/Users/hguo/repo/react/react-demo-hank/mock/smocks.js:85:4) at Module._compile...
Example from documentation, i just change smocks.route to smocks.plugin: ``` js smocks.plugin({ // ... input: { yourPhoneNumber: { label: 'What is your phone number?', type: 'text', defaultValue: '999.867.5309' } },...
Check documentation: ``` set an active route variant POST to {host}:{port}/_admin/api/route/{routeId}/variant/{variantId} ``` It's wrong. Working example: ``` js fetch('/_admin/api/route/{routeId}', { method: 'POST', body: JSON.stringify({ variant: 'my-variant' }) }) ```
When using Smocks.plugin onRequest the reply object doesn't get properly wrapped. ``` Smocks.plugin({ onRequest: function (request, reply, next) { reply.redirect(path).send(); next(); }, onResponse: function (request, response) { console.log('onResponse:'); } });...
When smocks is used as a PLUGIN on a `hapi` server instance which could have more than 1 connection, the individual connection properties are not set correctly. For example, ```...