Giter VIP home page Giter VIP logo

integration-tester's Introduction

integration-tester

Integration tester.

Build Status

Installation

$ npm install segmentio/integration-tester

Example

assert(integration)
  .identify(identify)
  .sends('content-type', 'application/json')
  .sends({ baz: 'foo' })
  .expects({ users: { name: 'baz' } })
  .expects(200, end);
assert(integration)
  .sends('content-type', 'text/plain')
  .sends('x-baz', /foo/)
  .sends(/key=111/)
  .sends(/type=identify/)
  .expects(/success=true/)
  .expects(200, done);

API

Assertion(integration)

Initialize new Assertion with integration.

.requests(n)

Assert requests are n.

.retries(n)

Assert retries are n.

.timeout(ms)

Assert timeout is ms, where ms can be either a string (2s) or a number (2000).

.name(name)

Assert name is n.

.endpoint(url)

Assert endpoint is url.

.pathname(url)

Assert request pathname is url.

.valid(msg, settings)

Assert the integration is valid with msg, settings.

.invalid(msg, settings)

Assert the integration is invalid with msg, settings.

query(obj)

Add query.

Example:

Assertion(integration)
  .set('token', 'e16481cb')
  .identify({ userId: 1 })
  .query({ identify: true })
  .query({ userid: 1 })
  .expects(200, done);
set(key, value)

Set object key or key, value settings.

sends(...)

Assert integration sends ...

// examples
sends({ baz: 'foo' });
sends(/baz=foo/);
sends('?query=string');
sends('baz=foo');
expects(...)

Assert integration expects ...

// examples
expects({ success: true });
expects(/success=true/);
expects('success=true');
expects(200);
end(fn)

End assertions with fn.

error(fn)

Assert integration calls fn(err).

enabled(msg)

throws if the integration isn't enabled on msg.

disabled(msg)

throws if the integration isn't disabled on msg.

CHANNEL(msg)

throws if the integration isn't enabled on channel with optional msg.

// examples
server();
client();
mobile();
all()

throws if the integration isn't enabled on all channels.

License

(MIT)

integration-tester's People

Contributors

calvinfo avatar juliangruber avatar yields avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.