Skip to content

Commit 902c6f4

Browse files
committed
enable commented out unit tests
1 parent 75a92e3 commit 902c6f4

File tree

2 files changed

+48
-34
lines changed

2 files changed

+48
-34
lines changed

lib/models/notifications/notifier.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Notifier.prototype.makeOnBuildMessage = function(githubPushInfo) {
6565
};
6666

6767
// should be implemented in the subclass
68-
Notifier.prototype.makeOnInstancesMessage = function(githubPushInfo, instances) {
68+
Notifier.prototype.makeOnInstancesMessage = function(/* githubPushInfo, instances */) {
6969
throw new Error('Not implemented');
7070
};
7171

unit/instances.js

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -436,11 +436,11 @@ describe('Instance', function () {
436436
});
437437

438438

439-
describe('find by repo', function () {
439+
describe('find by repo and branch', function () {
440440
var savedInstance1 = null;
441441
var savedInstance2 = null;
442442
var savedInstance3 = null;
443-
beforeEach(function (done) {
443+
before(function (done) {
444444
var instance = createNewInstance('instance1');
445445
instance.save(function (err, instance) {
446446
if (err) { return done(err); }
@@ -451,7 +451,7 @@ describe('Instance', function () {
451451
}
452452
});
453453
});
454-
beforeEach(function (done) {
454+
before(function (done) {
455455
var instance = createNewInstance('instance2', {locked: false});
456456
instance.save(function (err, instance) {
457457
if (err) { return done(err); }
@@ -462,7 +462,7 @@ describe('Instance', function () {
462462
}
463463
});
464464
});
465-
beforeEach(function (done) {
465+
before(function (done) {
466466
var instance = createNewInstance('instance3', {locked: true, repo: 'podviaznikov/hello'});
467467
instance.save(function (err, instance) {
468468
if (err) { return done(err); }
@@ -474,35 +474,49 @@ describe('Instance', function () {
474474
});
475475
});
476476

477-
// it('should find instances using repo name and branch', function (done) {
478-
// Instance.findInstancesLinkedToBranch('bkendall/flaming-octo-nemisis._', 'master', function (err, insts) {
479-
// if (err) { return done(err); }
480-
// expect(insts.length).to.equal(2);
481-
// insts.forEach(function (inst) {
482-
// expect(['instance1', 'instance2']).to.include(inst.name);
483-
// });
484-
// done();
485-
// });
486-
// });
487-
488-
// it('should not find instance using repo name and branch if it was locked', function (done) {
489-
// Instance.findInstancesLinkedToBranch('podviaznikov/hello', 'master', function (err, insts) {
490-
// if (err) { return done(err); }
491-
// expect(insts.length).to.equal(0);
492-
// done();
493-
// });
494-
// });
495-
496-
// it('should find context versions using repo name and branch', function (done) {
497-
// Instance.findContextVersionsForRepoBranch('bkendall/flaming-octo-nemisis._', 'master', function (err, cvs) {
498-
// if (err) { return done(err); }
499-
// expect(cvs.length).to.equal(2);
500-
// var actual = [String(cvs[1]), String(cvs[0])];
501-
// expect(actual).to.deep.include(String(savedInstance1.contextVersion._id));
502-
// expect(actual).to.deep.include(String(savedInstance2.contextVersion._id));
503-
// done();
504-
// });
505-
// });
477+
it('should find instances using repo name and branch', function (done) {
478+
Instance.findInstancesLinkedToBranch('bkendall/flaming-octo-nemisis._', 'master', function (err, insts) {
479+
if (err) { return done(err); }
480+
expect(insts.length).to.equal(2);
481+
insts.forEach(function (inst) {
482+
expect(['instance1', 'instance2']).to.include(inst.name);
483+
});
484+
done();
485+
});
486+
});
487+
488+
it('should not find instance using repo name and branch if it was locked', function (done) {
489+
Instance.findInstancesLinkedToBranch('podviaznikov/hello', 'master', function (err, insts) {
490+
if (err) { return done(err); }
491+
expect(insts.length).to.equal(0);
492+
done();
493+
});
494+
});
495+
496+
});
497+
498+
describe('#findContextVersionsForRepo', function () {
499+
var savedInstance = null;
500+
before(function (done) {
501+
var instance = createNewInstance('instance-name', {locked: true, repo: 'podviaznikov/hello'});
502+
instance.save(function (err, instance) {
503+
if (err) { return done(err); }
504+
else {
505+
expect(instance).to.be.okay;
506+
savedInstance = instance;
507+
done();
508+
}
509+
});
510+
});
511+
it('should find context versions using repo name', function (done) {
512+
Instance.findContextVersionsForRepo('podviaznikov/hello', function (err, cvs) {
513+
if (err) { return done(err); }
514+
expect(cvs.length).to.equal(1);
515+
expect(String(cvs[0])).to.equal(String(savedInstance.contextVersion._id));
516+
done();
517+
});
518+
});
519+
506520
});
507521

508522

0 commit comments

Comments
 (0)