UNPKG

eventric-testing

Version:
87 lines (67 loc) 2.82 kB
var EventricTesting, aggregateFactory, eventualConsistencyUtilities, fakePromise, remoteFactory, wiredRemotes, slice = [].slice; aggregateFactory = require('./aggregate_factory'); fakePromise = require('./fake_promise'); eventualConsistencyUtilities = require('./eventual_consistency_utilities'); remoteFactory = require('./remote_factory'); wiredRemotes = []; EventricTesting = (function() { function EventricTesting() {} EventricTesting.prototype.resolve = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.resolve.apply(fakePromise, args); }; EventricTesting.prototype.reject = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.reject.apply(fakePromise, args); }; EventricTesting.prototype.resolveAsync = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.resolveAsync.apply(fakePromise, args); }; EventricTesting.prototype.rejectAsync = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return fakePromise.rejectAsync.apply(fakePromise, args); }; EventricTesting.prototype.wiredAggregate = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return aggregateFactory.wiredAggregate.apply(aggregateFactory, args); }; EventricTesting.prototype.wiredRemote = function() { var args, wiredRemote; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; wiredRemote = remoteFactory.wiredRemote.apply(remoteFactory, args); wiredRemotes.push(wiredRemote); return wiredRemote; }; EventricTesting.prototype.destroy = function() { var i, len, wiredRemote; for (i = 0, len = wiredRemotes.length; i < len; i++) { wiredRemote = wiredRemotes[i]; wiredRemote.$destroy(); } return wiredRemotes = []; }; EventricTesting.prototype.waitForQueryToReturnResult = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForQueryToReturnResult.apply(eventualConsistencyUtilities, args); }; EventricTesting.prototype.waitForCommandToResolve = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForCommandToResolve.apply(eventualConsistencyUtilities, args); }; EventricTesting.prototype.waitForResult = function() { var args; args = 1 <= arguments.length ? slice.call(arguments, 0) : []; return eventualConsistencyUtilities.waitForResult.apply(eventualConsistencyUtilities, args); }; return EventricTesting; })(); module.exports = new EventricTesting;