javascript - how to mock providers specified in @component meta data in angular-2.0.0-rc-4 -


since, overrideproviders not supported in angular-2.0.0-rc-4.

i tried using

beforeeach(() => { addproviders([     testcomponentbuilder,     feedslistcomponent, {         provide: feedsservice,         useclass: mockfeedsservice     } ]); 

});

i able mock service if provided @ bootstrap phase. if it's provided @componet level below

@component({  ...  providers: ['feedsservice'] }) class feedslistcomponent { } 

even if used provide it's not taking mockedservice. so, there alternative way mock services specified in @component meta data instead of overrideproviders

you need use overrideproviders testcomponentbuilder

https://angular.io/docs/ts/latest/api/core/testing/testcomponentbuilder-class.html


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -