2015-05-18 10:16:18 -07:00
|
|
|
var lib = require('requirefrom')('lib');
|
|
|
|
var executeWatcher = lib('execute_watcher');
|
|
|
|
var expect = require('expect.js');
|
|
|
|
module.exports = function testNoExecute(options, message, generateRawData) {
|
|
|
|
describe(message, function () {
|
|
|
|
var response;
|
|
|
|
beforeEach(function () {
|
|
|
|
this.timeout(5000);
|
|
|
|
var rawData = generateRawData();
|
|
|
|
var fixture = {
|
|
|
|
indexPattern: options.indexPattern,
|
|
|
|
type: options.type,
|
2015-08-06 15:30:05 -07:00
|
|
|
dateField: 'timestamp',
|
2015-05-18 10:16:18 -07:00
|
|
|
rawData: rawData
|
|
|
|
};
|
|
|
|
return executeWatcher(options.watcher, fixture).then(function (resp) {
|
|
|
|
response = resp;
|
|
|
|
if (process.env.DEBUG) console.log(JSON.stringify(resp, null, ' '));
|
|
|
|
return resp;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it('should not meet the script condition', function () {
|
|
|
|
expect(response.state).to.be('execution_not_needed');
|
|
|
|
expect(response.execution_result.condition.script.met).to.be(false);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|