0.0.6 • Published 10 years ago

bulkhead-test v0.0.6

Weekly downloads
3
License
GPL v2
Repository
github
Last release
10 years ago

bulkhead-test

A functional testing suite for Bulkhead services. This package uses:

Quick start

npm install bulkhead-test

Configuration

  • All tests need to be in JavaScript and in a folder called test in the package root with a .js extension.
  • All fixtures need to be in JSON format and in a folder called test/fixtures in the package root with a .json extension. (See Barrels for more details)
  • All fixture names need to be consisting of the package name, an underscore, and the model name in lower case. (Example: If your package is called testPackage and your model is called Account.js, the fixture needs to be called testPackage_account.json)
  • You will need to lift the sails application before tests are ran. This can be done with the following:
var suite = require('bulkhead-test');
  
describe('A test category', function() {

  suite.lift();  // You lift sails during in your suite description

  describe('Some test', function() {
  	it('should test', function(done) {
      /* ... */
      done();
  });
});

To perform REST tests against the application, do the following:

var suite = require('bulkhead-test');
  
describe('A test category', function() {
  suite.lift();
  describe('A category breakdown', function() {
    it('should do REST testing', function(done) {
      // Using suite.rest() will allow you to utilize the Supertest API
      suite.rest()
        .get('/')
        .end(function(err, res) {
          done();
        }
      );
    })
  });
});

For more help with REST testing, check out supertest.