Last active
August 29, 2015 14:14
-
-
Save LinuxBozo/c28b038485018dd303c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shmock = require('shmock'); | |
var mockAPI = shmock(10000); | |
mockAPI.get('/foo').reply(200, 'bar'); | |
mockAPI.get('/isChildFI/2013/1').reply(200, JSON.stringify({ result: true })); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('sync-request'); | |
var resp1 = request('GET', 'http://localhost:10000/foo'); | |
console.log(resp1.getBody('utf8')); | |
var resp2 = request('GET', 'http://localhost:10000/isChildFI/2013/1'); | |
console.log(resp2.getBody('utf8')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node mockserver.js && node output_tests.js | |
bar | |
{"result":true} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment