fix(ivy): unable to override ComponentFactoryResolver provider in tests (#32512)
PR Close #32512
This commit is contained in:

committed by
Matias Niemelä

parent
72807101ed
commit
21245887e6
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
import {CompilerConfig, ResourceLoader} from '@angular/compiler';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, Directive, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
||||
import {CUSTOM_ELEMENTS_SCHEMA, Compiler, Component, ComponentFactoryResolver, Directive, Inject, Injectable, InjectionToken, Injector, Input, NgModule, Optional, Pipe, SkipSelf, ɵstringify as stringify} from '@angular/core';
|
||||
import {TestBed, async, fakeAsync, getTestBed, inject, tick, withModule} from '@angular/core/testing';
|
||||
import {expect} from '@angular/platform-browser/testing/src/matchers';
|
||||
import {ivyEnabled, modifiedInIvy, obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
|
||||
@ -418,6 +418,16 @@ const bTok = new InjectionToken<string>('b');
|
||||
});
|
||||
|
||||
describe('overriding providers', () => {
|
||||
|
||||
describe('in core', () => {
|
||||
it('ComponentFactoryResolver', () => {
|
||||
const componentFactoryMock =
|
||||
jasmine.createSpyObj('componentFactory', ['resolveComponentFactory']);
|
||||
TestBed.overrideProvider(ComponentFactoryResolver, {useValue: componentFactoryMock});
|
||||
expect(TestBed.get(ComponentFactoryResolver)).toEqual(componentFactoryMock);
|
||||
});
|
||||
});
|
||||
|
||||
describe('in NgModules', () => {
|
||||
|
||||
it('should support useValue', () => {
|
||||
|
Reference in New Issue
Block a user