mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2025-02-17 01:12:20 +00:00
Use latest node and fix tests
This commit is contained in:
parent
ef456896de
commit
132f8019b1
6 changed files with 22 additions and 20 deletions
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
@ -0,0 +1 @@
|
|||
0.12.7
|
|
@ -23,6 +23,6 @@ EnslClient.prototype.getUserById = function (options, callback) {
|
|||
|
||||
EnslClient.prototype.getFullAvatarUri = function (url) {
|
||||
return this.baseUrl + url;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = EnslClient;
|
|
@ -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
1
mocha.opts
Normal file
|
@ -0,0 +1 @@
|
|||
--harmony
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue