Use latest node and fix tests

This commit is contained in:
Chris Blanchard 2015-08-09 16:29:15 +01:00
parent ef456896de
commit 132f8019b1
6 changed files with 22 additions and 20 deletions

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
0.12.7

View file

@ -23,6 +23,6 @@ EnslClient.prototype.getUserById = function (options, callback) {
EnslClient.prototype.getFullAvatarUri = function (url) {
return this.baseUrl + url;
}
};
module.exports = EnslClient;

View file

@ -19,18 +19,17 @@ function Gather (options) {
return new Gather(options);
}
if (options) {
if (typeof options.onEvent === 'function') {
this.onEvent = options.onEvent;
} else {
this.onEvent = function () {}; // Noop
}
if (typeof options.onDone === 'function') {
this.onDone = options.onDone;
} else {
this.onDone = function () {};
}
if (options && typeof options.onEvent === 'function') {
this.onEvent = options.onEvent;
} else {
this.onEvent = ()=>{};
}
if (options && typeof options.onDone === 'function') {
this.onDone = options.onDone;
} else {
this.onDone = ()=>{};
}
this.TEAM_SIZE = 6;

1
mocha.opts Normal file
View file

@ -0,0 +1 @@
--harmony

View file

@ -43,16 +43,17 @@ describe("Gather Model:", function () {
});
});
describe("Election Tmimeout", function () {
describe("Election Timeout", function () {
it ("starts a timer and transitions to next state when timer runs out", function (done) {
gather = new Gather({
onElectionTimeout: function () {
assert.equal(gather.current, "selection");
assert.isNull(gather.electionStartTime);
done();
onEvent: function () {
if (gather.current === "selection") {
assert.isNull(gather.electionStartTime);
done();
}
}
});
gather.ELECTION_INTERVAL = 10; // 10ms
gather.ELECTION_INTERVAL = 100; // 10ms
assert.isNull(gather.electionStartTime);
gatherers.forEach(function (gatherer) {
gather.addGatherer(gatherer);

View file

@ -39,7 +39,7 @@ describe("Message Model", function () {
describe(".list", function () {
beforeEach(function (done) {
var instructions = [];//[helper.clearDb.bind(null)];
var instructions = [helper.clearDb.bind(null)];
for (var i = 0; i < 31; i++) {
instructions.push(function (content) {
return function (callback) {
@ -56,7 +56,7 @@ describe("Message Model", function () {
assert.isTrue(messages.reduce(function (acc, message, index, arr) {
if (index === 0) return true;
if (acc === false) return false;
return arr[index - 1].createdAt > message.createdAt;
return arr[index - 1].createdAt <= message.createdAt;
}));
assert.isTrue(messages.some(function (message) {
return message.content === "30";