Have ideas to improve npm?Join in the discussion! »

    attendant

    1.0.1 • Public • Published

    attendant

    NPM version build status Test coverage

    A super tiny test server. Best used to test your frontend packages.

    Installation

    $ npm i --save attendant

    Overview

    /**
     * Initialize the server and set
     * the response body.
     */
     
    var attendant = require('attendant');
    var request = require('supertest');
    var server = attendant({foo: 'bar'});
     
    /**
     * Run tests.
     */
     
    request(server.listen())
      .get('/')
      .expect('Content-Type', /json/)
      .expect(200, done);

    API

    attendant()

    // Initialize the server. Takes
    // an {Object} body as an argument
    // to send back as a response.
     
    var attendant = require('attendant');
    var request = require('supertest');
    var server = attendant({tobi: 'ferret'});
     
    request(server.listen())
      .get('/')
      .expect('Content-Type', /json/)
      .expect(200, done);
     
    request(server.listen())
      .put('/')
      .send({cat: 'dog'})
      .expect(204, done);

    License

    MIT © Yoshua Wuyts

    Keywords

    none

    Install

    npm i attendant

    DownloadsWeekly Downloads

    1

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • avatar