UNPKG

chimpy

Version:

Develop acceptance tests & end-to-end tests with realtime feedback.

79 lines (76 loc) 2.74 kB
"use strict"; var Chimp = require('./chimp'); describe('Chimp', function () { before(function () { var emptyFn = function emptyFn() {}; td.replace('async', {}); td.replace('path', { resolve: emptyFn, join: emptyFn }); td.replace('chokidar', {}); td.replace('underscore', {}); td.replace('./log', {}); td.replace('freeport', {}); td.replace('xolvio-ddp', {}); td.replace('hapi', {}); td.replace('./ddp-watcher', {}); td.replace('colors', {}); td.replace('./boolean-helper', {}); td.replace('./mocha/mocha.js', {}); td.replace('./jasmine/jasmine.js', {}); td.replace('./cucumberjs/cucumber.js', {}); td.replace('./phantom.js', {}); td.replace('./chromedriver.js', {}); td.replace('./consoler.js', {}); td.replace('./selenium.js', {}); td.replace('./simian-reporter.js', {}); }); after(function () { td.reset(); }); describe('constructor', function () { beforeEach(function () { this.chimp = new Chimp(); }); it('should create a new instance', function () { expect(this.chimp).not.to.equal(null); }); it('should initialize a processes array', function () { expect(this.chimp.processes).to.be["instanceof"](Array); }); it('should initialize an options object if no options are provided', function () { expect(this.chimp.options).to.be.instanceOf(Object); }); it('should store the options object if provided', function () { var myOptions = {}; var chimp = new Chimp(myOptions); expect(chimp.options).to.equal(myOptions); }); it('should store all the provided options on the environment hash prefixed with [chimp.]', function () { var myOptions = { a: 1, b: 'aString' }; var chimp = new Chimp(myOptions); expect(process.env['chimp.a']).to.equal(myOptions.a.toString()); expect(process.env['chimp.b']).to.equal(myOptions.b); }); it('puts single ddp option on the environment hash as [chimp.ddp0] if only one provided', function () { var myOptions = { ddp: 'http://host:port' }; var chimp = new Chimp(myOptions); expect(process.env['chimp.ddp0']).to.equal(myOptions.ddp.toString()); expect(process.env['chimp.ddp1']).to.be.undefined; }); it('puts multiple ddp options on the environment hash as [chimp.ddpX] if multiple provided', function () { var myOptions = { ddp: ['http://host:port1', 'http://host:port2'] }; var chimp = new Chimp(myOptions); expect(process.env['chimp.ddp0']).to.equal(myOptions.ddp[0].toString()); expect(process.env['chimp.ddp1']).to.equal(myOptions.ddp[1].toString()); }); }); });