Skip to content

Commit

Permalink
Update: Switch to mocha/expect for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed May 14, 2018
1 parent b86b7ba commit 0a216e0
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 33 deletions.
18 changes: 11 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,20 @@
"index.js"
],
"scripts": {
"test": "lab -cvL --ignore store@sparkles"
"lint": "eslint .",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
},
"dependencies": {},
"devDependencies": {
"@phated/eslint-config-iceddev": "^0.2.1",
"code": "^1.5.0",
"eslint": "^1.3.1",
"eslint-plugin-mocha": "^0.5.1",
"eslint-plugin-react": "^3.3.1",
"lab": "^5.16.0"
"eslint": "^2.0.0",
"eslint-config-gulp": "github:gulpjs/eslint-config-gulp",
"expect": "^1.19.0",
"istanbul": "^0.4.3",
"istanbul-coveralls": "^1.0.3",
"mocha": "^3.5.0"
},
"keywords": [
"ee",
Expand Down
11 changes: 4 additions & 7 deletions test/exists.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
'use strict';

var lab = exports.lab = require('lab').script();
var describe = lab.describe;
var it = lab.it;
var expect = require('code').expect;
var expect = require('expect');

var sparkles = require('../');

describe('sparkles.exists()', function(){

it('checks if a namespace has been defined', function(done){
expect(sparkles.exists('test')).to.be.false();
expect(sparkles.exists('test')).toBe(false);
var ee = sparkles('test');
expect(sparkles.exists('test')).to.be.true();
expect(sparkles.exists('test')).toBe(true);
ee.remove();
expect(sparkles.exists('test')).to.be.false();
expect(sparkles.exists('test')).toBe(false);
done();
});
});
17 changes: 6 additions & 11 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
'use strict';

var lab = exports.lab = require('lab').script();
var describe = lab.describe;
var it = lab.it;
var beforeEach = lab.beforeEach;
var afterEach = lab.afterEach;
var expect = require('code').expect;
var expect = require('expect');

var sparkles = require('../');

Expand All @@ -25,20 +20,20 @@ describe('sparkles()', function(){
done();
});

it('will attach the sparkles store namespace to global', function(done){
expect(global['store@sparkles']).to.exist();
it('will attach the sparkles store namespace to global', function(done) {
expect(global['store@sparkles']).toExist();
done();
});

it('will attach an event emitter to the sparkles store default namespace', function(done){
expect(global['store@sparkles']).to.include('default');
it('will attach an event emitter to the sparkles store default namespace', function(done) {
expect(global['store@sparkles']).toIncludeKey('default');
done();
});

it('removes the event emitter from the store when remove is called', function(done){
ee.on('test', noop);
ee.remove();
expect(global['store@sparkles']).to.not.include('default');
expect(global['store@sparkles']).toNotIncludeKey('default');
done();
});
});
11 changes: 3 additions & 8 deletions test/namespace.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
'use strict';

var lab = exports.lab = require('lab').script();
var describe = lab.describe;
var it = lab.it;
var beforeEach = lab.beforeEach;
var afterEach = lab.afterEach;
var expect = require('code').expect;
var expect = require('expect');

var EventEmitter = require('events').EventEmitter;

Expand All @@ -27,7 +22,7 @@ describe('namespace', function(){

var sparkles = require('../')();

expect(sparkles.custom).to.equal('ee');
expect(sparkles.custom).toEqual('ee');
done();
});

Expand All @@ -37,7 +32,7 @@ describe('namespace', function(){

var sparkles = require('../')('customNamespace');

expect(sparkles.custom).to.equal(true);
expect(sparkles.custom).toEqual(true);
done();
});
});

0 comments on commit 0a216e0

Please sign in to comment.