npm.io
1.0.2 • Published 7 years ago

mocksome-client

Licence
ISC
Version
1.0.2
Deps
2
Size
5 kB
Vulns
1
Weekly
0

PRE-RELEASE - NOT READY FOR PUBLIC CONSUMPTION YET!!

NodeJS client for Mocksome, Mocking Server

To Install

npm install mocksome-client

Simple example

const MockServerClient = require('mocksome-client');
const { path } = require('mocksome-client/queries');
const responses = require('mocksome-client/responses');

const client = new MockServerClient('http://localhost:8080');

const run = async () => {
  await client.expectation()
              .with(path('/somepath'))
              .response(responses.json.ok({ hello: 'goodbye' }))
              .create();
}

run();

Will return:

curl http://localhost:8080/somepath

{"hello":"goodbye"}