You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A way to override instances of PrimordialInjector in unit tests #614
@mhevery this could probably not land before we switch to TS as there is no way to introspect the type of anonymous fn parameters.
However I have started to work on it, could you please give feedback on the following (we can discuss about it on our next sync)
describe('describe',()=>{// - beforeEach would be executed after beforeEachBindings// - then we can imagine that we could inject classes in the cb// - there is a gotcha with nested beforeEachBindings because we can not create// the injector before all beforeEachBindings have been executed beforeEach((c: AClass,async: AsyncCompleter)=>{// injectabe ?});// IMO it's easier to define the bindings in a function rather than to have// bind() available in describe().// As of now the function should return a list of bindings, we use the same// syntax as in non-test code.beforeEachBindings(()=>[AClass,bind(Router).toClass(MockRouter)]);// It is possible to inject into it() callback.// AsyncCompleter allow completing async tests (like done in jasmine)it('it',(class: AClass,router: Router,async: AsyncCompleter)=>{router.route().then(()=>{async.done();});});describe(...,()=>{// This should be executed before any BeforeEach (even in the parent describe)// if we want to be able to inject into BeforeEach callbacks.beforeEachBindings(()=>[BClass,]);it(...);});})
Activity
vicb commentedon Mar 11, 2015
@mhevery this could probably not land before we switch to TS as there is no way to introspect the type of anonymous fn parameters.
However I have started to work on it, could you please give feedback on the following (we can discuss about it on our next sync)
angular-automatic-lock-bot commentedon Sep 5, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.