摩卡柴测试用例角度配置文件 [英] Mocha Chai test case for angular configuration file

查看:163
本文介绍了摩卡柴测试用例角度配置文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个很难解决的摩卡钗测试用例角的js配置文件。

I am getting a hard time to resolve mocha chai test case for angular js configuration file .

angular.module('myApp.myModule', []).config(function ($stateProvider, $urlRouterProvider) {
$stateProvider.state('myModule', {
  url: '/myModule',
  templateUrl: function(){
    return 'scripts/my-module/views/my-module.html';
  },
  controller: 'myModuleCtrl',
  controllerAs: 'myCtrl',
  css: 'styles/lazy-load/my-module.css'
});
$urlRouterProvider.otherwise('/');

})

我需要支付摩卡钗测试用例它返回一个URLtemplateUrl的复位功能('脚本/我的模块/视图/我-module.html')

I need to cover mocha chai test case for return function of "templateUrl" which is returning a url ('scripts/my-module/views/my-module.html').

推荐答案

我做到了像

it('should load the page.', inject(function ($state) {
    var state = $state.get('selectLine');
    assert.isDefined(state.templateUrl()); 
    expect(state.templateUrl()).to.equal('scripts/select-line-module/views/select-line.html');
}));

这对我的作品

这篇关于摩卡柴测试用例角度配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆