We have some internal proxies for all of the Jasmine functions, as well as some other helpers. This code hasn't been touched in more than 5 years, it can lead to confusion and it isn't really necessary since the same can be achieved using Jasmine. These changes remove most of the code and clean up our existing unit tests. PR Close #42177
		
			
				
	
	
		
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
/**
 | 
						|
 * @license
 | 
						|
 * Copyright Google LLC All Rights Reserved.
 | 
						|
 *
 | 
						|
 * Use of this source code is governed by an MIT-style license that can be
 | 
						|
 * found in the LICENSE file at https://angular.io/license
 | 
						|
 */
 | 
						|
 | 
						|
import {NgModule} from '@angular/core';
 | 
						|
import {JitReflector} from '@angular/platform-browser-dynamic/src/compiler_reflector';
 | 
						|
 | 
						|
import {MockNgModuleResolver} from '../testing';
 | 
						|
 | 
						|
{
 | 
						|
  describe('MockNgModuleResolver', () => {
 | 
						|
    let ngModuleResolver: MockNgModuleResolver;
 | 
						|
 | 
						|
    beforeEach(() => {
 | 
						|
      ngModuleResolver = new MockNgModuleResolver(new JitReflector());
 | 
						|
    });
 | 
						|
 | 
						|
    describe('NgModule overriding', () => {
 | 
						|
      it('should fallback to the default NgModuleResolver when templates are not overridden',
 | 
						|
         () => {
 | 
						|
           const ngModule = ngModuleResolver.resolve(SomeNgModule);
 | 
						|
           expect(ngModule.declarations).toEqual([SomeDirective]);
 | 
						|
         });
 | 
						|
 | 
						|
      it('should allow overriding the @NgModule', () => {
 | 
						|
        ngModuleResolver.setNgModule(
 | 
						|
            SomeNgModule, new NgModule({declarations: [SomeOtherDirective]}));
 | 
						|
        const ngModule = ngModuleResolver.resolve(SomeNgModule);
 | 
						|
        expect(ngModule.declarations).toEqual([SomeOtherDirective]);
 | 
						|
      });
 | 
						|
    });
 | 
						|
  });
 | 
						|
}
 | 
						|
 | 
						|
class SomeDirective {}
 | 
						|
 | 
						|
class SomeOtherDirective {}
 | 
						|
 | 
						|
@NgModule({declarations: [SomeDirective]})
 | 
						|
class SomeNgModule {
 | 
						|
}
 |