Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

Latest commit

 

History

History
23 lines (18 loc) · 603 Bytes

README.md

File metadata and controls

23 lines (18 loc) · 603 Bytes

mystique-server

👾 A simple mock-server for using in node.js E2E tests.

Usage

async function test() {
  let mockServer = await createMockRestServer(8585);
  let promise = codeThatCallsEndpoint({number: 20});
  await mockServer.post('/endpoint', async function (req) {
    assert(req.body.number === 20, 'number should be 20');
    return {result: 'ok'}
  });
  let {result} = await promise;

  assert(result === 'okay', 'result must be okay');

  console.log('done');
}

License

This project is licensed under the MIT License - see the LICENSE file for details