Skip to content
This repository was archived by the owner on Mar 5, 2018. It is now read-only.

Commit d9c0cfb

Browse files
committed
Improve job list test
1 parent f816418 commit d9c0cfb

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"debug": "^1.0.2",
1212
"jscs": "^1.5.7",
1313
"jshint": "^2.5.1",
14+
"lodash": "^2.4.1",
1415
"mocha": "^1.20.1",
1516
"node-uuid": "^1.4.1",
1617
"should": "^4.0.4"

test/chronos.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
* Module dependencies.
55
*/
66

7+
var async = require('async');
8+
var lodash = require('lodash');
79
var should = require('should');
810
var uuid = require('node-uuid');
911

@@ -23,12 +25,48 @@ describe('Chronos', function() {
2325
this.chronos.on('debug', helper.debug('mesos:chronos'));
2426
});
2527

28+
beforeEach(function(done) {
29+
var self = this;
30+
31+
self.name = 'test-' + uuid.v4();
32+
self.owner = 'owner@example.org';
33+
34+
var jobs = {};
35+
36+
jobs.create = function(cb) {
37+
var options = {
38+
schedule: 'R10/2012-10-01T05:52:00Z/PT2S',
39+
name: self.name,
40+
epsilon: 'PT15M',
41+
command: 'true',
42+
owner: self.owner,
43+
async: false,
44+
};
45+
46+
self.chronos.create(options, cb);
47+
};
48+
49+
async.auto(jobs, done);
50+
});
51+
2652
it('should return jobs', function(done) {
53+
var self = this;
54+
2755
this.chronos.list(function(err, data) {
2856
should.not.exist(err);
2957

3058
should(data).be.instanceof(Array);
3159

60+
var job = lodash.find(data, function(job) {
61+
return self.name === job.name;
62+
});
63+
64+
should.exist(job);
65+
66+
job.name.should.eql(self.name);
67+
job.owner.should.eql(self.owner);
68+
job.disabled.should.eql(false);
69+
3270
done();
3371
});
3472
});

0 commit comments

Comments
 (0)