Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Added eslint support.
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed Feb 28, 2015
1 parent 05b9411 commit 9305ac2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"node": true
},

"rules": {
"camelcase": [0],
"curly": [0],
"quotes": [1, "double"],
"eol-last": [0],
"key-spacing": [0],
"no-alert": [0],
"no-comma-dangle": [0],
"no-mixed-requires": [0],
"no-multi-spaces": [0],
"no-new": [0],
"no-shadow": [0],
"no-trailing-spaces": [2],
"no-underscore-dangle": [0],
"no-unused-vars": [1]
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
"description": "Flux experiment.",
"main": "index.js",
"scripts": {
"test": "istanbul cover node_modules/.bin/_mocha --report html --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
"lint": "eslint index.js test.js",
"test": "npm run lint && istanbul cover node_modules/.bin/_mocha --report html --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"devDependencies": {
"bluebird": "^2.9.6",
"chai": "^1.10.0",
"coveralls": "^2.11.2",
"eslint": "^0.15.1",
"istanbul": "^0.3.5",
"mocha": "^2.1.0",
"mocha-lcov-reporter": "0.0.1",
Expand Down
12 changes: 10 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*global Promise:true, describe, it, beforeEach*/
"use strict";

var DocBrown = require("./");
var expect = require("chai").expect;
var sinon = require("sinon");
Expand Down Expand Up @@ -138,12 +141,14 @@ describe("DocBrown.createActions()", function() {
});

it("should require a dispatcher", function() {
/*eslint new-cap:0*/
expect(function() {
DocBrown.createActions();
}).to.Throw(/Invalid dispatcher/);
});

it("should require an actions array", function() {
/*eslint new-cap:0*/
expect(function() {
DocBrown.createActions(dispatcher);
}).to.Throw(/Invalid actions array/);
Expand Down Expand Up @@ -213,6 +218,7 @@ describe("DocBrown.createStore()", function() {
});

it("should require a store prototype", function() {
/*eslint new-cap:0*/
expect(function() {
new (DocBrown.createStore())();
}).to.Throw(/Invalid store prototype/);
Expand All @@ -223,12 +229,14 @@ describe("DocBrown.createStore()", function() {
});

it("should ensure an actions array is provided", function() {
/*eslint new-cap:0*/
expect(function() {
new (DocBrown.createStore({}))();
}).to.Throw(/non-empty actions array/);
});

it("should ensure a non-empty actions array is provided", function() {
/*eslint new-cap:0*/
expect(function() {
new (DocBrown.createStore({actions: []}))();
}).to.Throw(/non-empty actions array/);
Expand All @@ -243,7 +251,7 @@ describe("DocBrown.createStore()", function() {
it("should apply initialize with constructor args if defined", function() {
var proto = {actions: [Actions], initialize: sinon.spy()};
var Store = DocBrown.createStore(proto);
var store = new Store(1, 2, 3);
new Store(1, 2, 3);

sinon.assert.calledOnce(proto.initialize);
sinon.assert.calledWithExactly(proto.initialize, 1, 2, 3);
Expand Down Expand Up @@ -418,7 +426,7 @@ describe("DocBrown.createStore()", function() {
return subscriber.getCall(0);
}
function expectNotUpdated(currentState, newState) {
if (!!setup(currentState, newState)) {
if (Boolean(setup(currentState, newState))) {
throw new Error("state updated");
}
}
Expand Down

0 comments on commit 9305ac2

Please sign in to comment.