it("prevents subsequent fetchJobDetail calls for specific jobID", function() { // Begin monitoring job details on specific ID MetronomeStore.monitorJobDetail("foo"); // Let three intervals run jest.advanceTimersByTime(3 * Config.getRefreshRate()); // Stop monitoring specific job's details MetronomeStore.stopJobDetailMonitor("foo"); // Initiate another 1 intervals to ensure the job is no longer fetched jest.advanceTimersByTime(1 * Config.getRefreshRate()); expect(MetronomeActions.fetchJobDetail.calls.count()).toEqual(4); });
it("continuously polls for job details", function() { // Begin monitoring job details MetronomeStore.monitorJobDetail("foo"); // Let three intervals run jest.advanceTimersByTime(3 * Config.getRefreshRate()); expect(MetronomeActions.fetchJobDetail.calls.count()).toEqual(4); });
it("calls the fetchJobs 3 times", function() { MetronomeStore.addChangeListener( EventTypes.METRONOME_JOBS_CHANGE, function() {} ); // Let two intervals run jest.advanceTimersByTime(2 * Config.getRefreshRate()); expect(MetronomeActions.fetchJobs.calls.count()).toEqual(3); });
} if (pid) { nodePID = pid.substring(0, pid.indexOf("@")); } return `${Config.rootUrl}/agent/${task.slave_id}/${nodePID}/state`; } var TaskDirectoryActions = { getDownloadURL(nodeID, path) { return `${Config.rootUrl}/agent/${nodeID}/files/download?path=${path}`; }, fetchNodeState: RequestUtil.debounceOnError( Config.getRefreshRate(), function(resolve, reject) { return function(task, node, innerPath) { return RequestUtil.json({ url: getNodeStateURL(task, node), success(response) { AppDispatcher.handleServerAction({ type: REQUEST_NODE_STATE_SUCCESS, data: response, task, node, innerPath }); resolve(); }, error(xhr) {