Angular Jasmine UI router inject resolve value into test

安稳与你 提交于 2019-11-30 17:56:46
Chandermani

Since there is no route involved in unit test you would have to inject the allTemplates as a normal object with $controller function. Can you try:

controller = $controller('QueriesCtrl as ctrl', {
                '$scope': scope,
                 'allTemplates':allTemplates 
            });

Else you can use the $provide API to create a dummy service.

 module(function ($provide) {
    $provide.value("allTemplates", {[{a:1}, {a:2}, {b:3}]});

Do it first thing in your beforEach block.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!