Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50655 views
1
/*
2
* macros.js: Test macros for the forever-monitor module
3
*
4
* (C) 2010 Nodejitsu Inc.
5
* MIT LICENCE
6
*
7
*/
8
9
var assert = require('assert'),
10
path = require('path'),
11
spawn = require('child_process').spawn,
12
fmonitor = require('../../lib');
13
14
var macros = exports;
15
16
macros.assertTimes = function (script, times, options) {
17
options.max = times;
18
19
return {
20
topic: function () {
21
var child = new (fmonitor.Monitor)(script, options);
22
child.on('exit', this.callback.bind({}, null));
23
child.start();
24
},
25
"should emit 'exit' when completed": function (err, child) {
26
assert.equal(child.times, times);
27
}
28
}
29
};
30
31
macros.assertStartsWith = function (string, substring) {
32
assert.equal(string.slice(0, substring.length), substring);
33
};
34
35
macros.assertList = function (list) {
36
assert.isNotNull(list);
37
assert.lengthOf(list, 1);
38
};
39