It looks like you can simply switch from 'as:' to 'name:' in route configs.
On Monday, January 4, 2016 at 11:14:14 AM UTC+3, Vasil Vasilev wrote: > > Hello, > > I am writing Karma test for a simple page that has tabstrip with each tab > routing to different component. > I have written a test for it. The first "it" statement passes OK, but when > I add second "it" I have the following error: > > Chrome 44.0.2403 (Windows 7 0.0.0) collections component Should be > switchable to Search FAILED > Failed: EXCEPTION: Error during instantiation of Router! > (CollectionsApp -> Router). > ORIGINAL EXCEPTION: Route config should contain exactly one "as" > or "name" property. > ORIGINAL STACKTRACE: > Error: Route config should contain exactly one "as" or "name" > property. > at new BaseException (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:8080:21) > at Object.normalizeRouteConfig (D:/angularPOC/ > collections.ng/test/angular2/router.dev.js:1638:13) > at RouteRegistry.config (D:/angularPOC/ > collections.ng/test/angular2/router.dev.js:2197:41) > at D:/angularPOC/ > collections.ng/test/angular2/router.dev.js:2232:28 > at Array.forEach (native) > at Array.forEach (D:/angularPOC/ > collections.ng/test/lib/es6-shim.js:1107:14) > at RouteRegistry.configFromComponent (D:/angularPOC/ > collections.ng/test/angular2/router.dev.js:2231:23) > at new RootRouter (D:/angularPOC/ > collections.ng/test/angular2/router.dev.js:2820:21) > at D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:1384:20 > at Injector._instantiate (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11926:19) > at Injector._instantiateProvider (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11859:21) > at Injector._new (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11849:19) > at InjectorDynamicStrategy.getObjByKeyId (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11733:42) > at Injector._getByKeyDefault (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:12048:33) > at Injector._getByKey (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:12002:21) > at Injector._getByDependency (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11990:21) > at Injector._instantiate (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11887:32) > at Injector._instantiateProvider (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11859:21) > at Injector._new (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11849:19) > at InjectorInlineStrategy.instantiateProvider (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11609:28) > at ElementInjectorInlineStrategy.hydrate (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:13234:20) > at ElementInjector.hydrate (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:12882:22) > at AppViewManagerUtils._hydrateView (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:9662:31) > at AppViewManagerUtils.hydrateRootHostView (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:9596:12) > at AppViewManager_.createRootHostView (D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:11268:19) > at D:/angularPOC/ > collections.ng/test/angular2/angular2.dev.js:14531:46 > at Zone.run (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:138:17) > at Zone.run (D:/angularPOC/ > collections.ng/node_modules/angular2/bundles/testing.dev.js:2544:30) > at zoneBoundFn (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:111:19) > at lib$es6$promise$$internal$$tryCatch (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:1511:16) > at lib$es6$promise$$internal$$invokeCallback (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:1523:17) > at lib$es6$promise$$internal$$publish (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:1494:11) > at D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:243:5 > at microtask (D:/angularPOC/ > collections.ng/node_modules/angular2/bundles/testing.dev.js:2557:15) > at Zone.run (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:138:17) > at Zone.run (D:/angularPOC/ > collections.ng/node_modules/angular2/bundles/testing.dev.js:2544:30) > at zoneBoundFn (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:111:19) > at MutationObserver.lib$es6$promise$asap$$flush (D:/angularPOC/ > collections.ng/test/angular2/angular2-polyfills.js:1305:9) > > I suppose something is wrong with my router configuration in the test > environment, but I have no clue how I could fix it. > > I have attached my unit test. > > Regards, > > Vasil > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
