How to use the di/testing.use function in di

To help you get started, we’ve selected a few di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / templating / test / lib / util / document_ready.spec.js View on Github external
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);
  });
github angular / templating / test / loader / precompiler.spec.js View on Github external
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);
    });