Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(()=>{
global = {
document: {
readyState: '',
addEventListener: jasmine.createSpy('doc.addEventListener'),
removeEventListener: jasmine.createSpy('doc.removeEventListener')
},
addEventListener: jasmine.createSpy('win.addEventListener'),
removeEventListener: jasmine.createSpy('win.removeEventListener'),
Promise: window.Promise
}
use(global).as(Global);
});
beforeEach(()=>{
moduleLoader = jasmine.createSpy('moduleLoader');
modules = {};
moduleLoader.and.callFake(function(moduleNames) {
return Promise.resolve(
moduleNames.filter((moduleName) => {
return !!modules[moduleName];
}).map((moduleName) => {
return modules[moduleName];
})
);
});
use(function() {
return moduleLoader;
}).as(ModuleLoader);
});