Skip to content

Commit

Permalink
feature: Combined backend and frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yamikuronue committed Dec 19, 2016
1 parent 9011c5a commit 92e0e88
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lint: .FORCE
eslint debug.js

test: .FORCE
mocha test/server/**.js
mocha test/**.js
karma start --single-run

.PHONY: all install clean distclean
4 changes: 2 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ module.exports = function(config) {

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'chai'],
frameworks: ['mocha', 'chai', 'sinon'],


// list of files / patterns to load in the browser
files: [
'dist/debug.js',
'test/client/*spec.js'
'test/*spec.js'
],


Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"karma-chai": "^0.1.0",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-sinon": "^1.0.5",
"mocha": "^3.2.0",
"sinon": "^1.17.6",
"sinon-chai": "^2.8.0"
Expand Down
9 changes: 0 additions & 9 deletions test/client/debug_spec.js

This file was deleted.

34 changes: 34 additions & 0 deletions test/debug_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* global describe, it */

if (typeof module !== 'undefined' && module.exports) {
const chai = require('chai');
const expect = chai.expect;

const debug = require('../src/index');
const sinon = require('sinon');
var sinonChai = require("sinon-chai");
chai.use(sinonChai);
}

const dummyConsole = {
log: function() {
//dummy function
}
};

debug.log = dummyConsole;


describe('debug', function () {
const log = debug('test');
log.log = sinon.stub();
it('passes a basic sanity check', function () {
expect(log('hello world')).to.not.throw;
});

it('Should output to the log function', function () {
sinon.spy(dummyConsole, 'log');
log('Hello world');
//expect(dummyConsole.log).to.have.been.called;
});
});
12 changes: 0 additions & 12 deletions test/server/debug_spec.js

This file was deleted.

0 comments on commit 92e0e88

Please sign in to comment.