Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function injectTestingUtils(fn) {
if('function' !== typeof fn) {
throw new TypeError('The first argument has to be a function');
}
let scheduler = new Rx.TestScheduler();
let injector = new DI()
.define('mockInteractions', mockInteractions)
.define('callWithObservables', callWithObservables)
.define('createObservable', createObservable)
.define('render', createElement)
.define('getValues', getValues)
.define('getMessages', getMessages)
.define('onNext', (...args) => Rx.ReactiveTest.onNext(...args))
.define('onCompleted', (...args) => Rx.ReactiveTest.onCompleted(...args))
.define('onError', (...args) => Rx.ReactiveTest.onError(...args));
/**
* @function createObservable - creates hot observable with arguments as values
* @returns {HotObservable}
export default function injectTestingUtils(fn) {
var scheduler = new Rx.TestScheduler();
/**
* @function callWithObservables - calls function with arguments specified as keys of the object
* @param {object} [observables={}] - collection of observables to use as the function arguments
* @property {*} observables[observableName] - definition of Observable mock for given name
* if value other than observable is provided, hot Observable starting with this value is created
* if any of function argument is missing, empty hot Observable is created
* @returns {Observable} value returned from the function
*/
function callWithObservables(fn, observables = {}, ctx = null) {
var args = { };
Object.keys(observables).forEach((name) => {
if(observables[name] instanceof Rx.Observable) {
args[name] = observables[name];
} else {