当我试图对我的控制器进行单元测试时,我收到错误.当我调试测试用例的期望值时,我得到了预期值,但是它的失败与下面的错误.我在这里丢失了什么,或者我正在测试一个错误的控制器变量方式?
原文链接:https://www.f2er.com/angularjs/140836.html我的规范文件在下面
'use strict'; describe('Information.controller',function () { beforeEach(angular.mock.module('asp')); var InformationController,scope; beforeEach(inject(function($controller,$rootScope) { scope = $rootScope.$new(); InformationController = $controller('InformationController',{ $scope: scope }); })); fit('Should remove the object without info from the object',function () { InformationController.Data = [ { "ban": "03745645455","accountNo": "0000drgyt456456565","id": "2c4cc5e8-f360367" },{ "ban": "27346fgh9080","accountNo": "000456456ytr655680","id": "2c4cc8ae-50bbf360367" } ]; InformationController.banList = InformationController.Data.map((value,index) => (value && value.ban ? {'id': index,'text': value.ban} : null)) .filter(value => value); expect(InformationController.banList.length).toBe(3); }); });