nci/test/distributor/helpers.js

26 lines
622 B
JavaScript
Raw Normal View History

2015-06-15 20:56:09 +00:00
'use strict';
var Node = require('../../lib/node').Node,
2016-01-05 11:18:20 +00:00
EventEmitter = require('events').EventEmitter,
ProjectsCollection = require('../../lib/project').ProjectsCollection;
2015-06-15 20:56:09 +00:00
exports.createNodeMock = function(executorRun) {
return function(params) {
var node = new Node(params);
node._createExecutor = function(project) {
var executor = new EventEmitter();
executor.project = project;
executor.run = executorRun;
return executor;
};
return node;
};
};
2016-01-05 11:18:20 +00:00
exports.createProjectsMock = function(configs) {
var projects = new ProjectsCollection({});
projects.configs = configs;
return projects;
};