swap-project-example
Version:
An example repository to illustrate to result of generating a project with generate-swap-project (https://github.com/rbecheras/generate-swap-project)
111 lines (90 loc) • 2.76 kB
JavaScript
;
require('mocha');
var _chai = require('chai');
var _chai2 = _interopRequireDefault(_chai);
var _debug = require('debug');
var _debug2 = _interopRequireDefault(_debug);
var _lib = require('../lib/');
var _lib2 = _interopRequireDefault(_lib);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const expect = _chai2.default.expect;
// import path from 'path'
const isCI = process.env.CI;
const isTravis = isCI || process.env.TRAVIS;
// const fixtures = path.resolve.bind(path, __dirname, 'fixtures')
// const testFolder = path.resolve.bind(path, __dirname, 'actual')
const d = (0, _debug2.default)('BDD');
d('starting');
let demoObj;
/**
* @test swap-project-example
*/
describe('swap-project-example', function () {
this.slow(250);
if (isCI || isTravis) {
before(done => {
const contextLabel = isTravis ? 'travis' : 'CI';
d(contextLabel + `test running`);
done();
});
}
beforeEach(done => {
demoObj = new _lib2.default();
done();
});
afterEach(done => {
// destroy things
done();
});
/**
* @test DemoClass
*/
describe('DemoClass', () => {
it('should be a valid class', done => {
expect(_lib2.default).to.be.a('function');
expect(_lib2.default).to.have.a.property('prototype');
expect(_lib2.default.prototype).to.be.an('object');
done();
});
it('should have a `concatenate` method', done => {
expect(_lib2.default.prototype).to.have.a.property('concatenate');
expect(_lib2.default.prototype.concatenate).to.be.a('function');
done();
});
/**
* @test instance
*/
describe('instance', () => {
it('should be an instance of DemoClass', done => {
expect(demoObj).to.be.an('object');
expect(demoObj).to.be.an.instanceOf(_lib2.default);
done();
});
it('should have a `propA` string property equal to A', done => {
expect(demoObj).to.have.a.property('propA');
expect(demoObj.propA).to.be.a('string');
expect(demoObj.propA).to.equal('A');
done();
});
it('should have a `propB` string property equal to B', done => {
expect(demoObj).to.have.a.property('propB');
expect(demoObj.propB).to.be.a('string');
expect(demoObj.propB).to.equal('B');
done();
});
});
/**
* @test #concatenate()
*/
describe('#concatenante', () => {
it('should concatenante demoObj.propA and demoObj.propB', done => {
let ret = demoObj.concatenate();
expect(ret).to.be.a('string');
expect(ret).to.equal('AB');
done();
});
});
});
});
d('finished');
//# sourceMappingURL=index.test.js.map