All files / test scripts.spec.js

100% Statements 11/11
100% Branches 0/0
100% Functions 6/6
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34    1x 1x 3x     1x 3x     1x 1x         1x 1x           1x 1x                
'use strict';
 
describe("Scripts", function() {
  beforeEach(function(done) {
    this.startServer({ dataPath: 'test/data/scripts' }).then(done, done.fail);
  });
 
  afterEach(function(done) {
    this.stopServer().then(done, done.fail);
  });
 
  it('should be able to execute basic scripts', function(done) {
    this.checkPaths('GET', {
      'api/basic': {status: 200, response: {message: 'OK'}},
    }).then(done, done.fail);
  });
 
  it('should be able to use the request', function(done) {
    this.checkPaths('GET', {
      'api/request?key=abcd': {status: 200, response: {value: 'abcd'}},
      'api/request?key=1234': {status: 200, response: {value: '1234'}},
    }).then(done, done.fail);
  });
 
  it('should be able to modify the HTTP status', function(done) {
    this.checkPaths('GET', {
      'api/status?code=200': {status: 200},
      'api/status?code=400': {status: 400},
      'api/status?code=404': {status: 404},
      'api/status?code=500': {status: 500},
    }).then(done, done.fail);
  });
});