在幻影中,因果单位测试失败

时间:2015-11-20 04:12:55

标签: phantomjs karma-runner angular-fullstack

在测试中修复了很多错误后,现在Karma输出是这样的:

PhantomJS 1.9.8(Windows 8 0.0.0)控制器:MainCtrl应该将一个列表附加到范围FAILED
           错误:意外请求:GET / api / marcas             预计不再需要......

api / marcas是我创建的终点。 MainCtrl的代码:

'use strict';

angular.module('app')
.controller('MainCtrl', function ($scope, $http, $log, socket, $location, $rootScope) {
    window.scope = $scope;
    window.rootscope = $rootScope
    $scope.awesomeThings = [];
    $scope.things = ["1", "2", "3"];



    $http.get('/api/things').success(function(awesomeThings) {
        $scope.awesomeThings = awesomeThings;
        socket.syncUpdates('thing', $scope.awesomeThings);
    });


    $scope.addThing = function() {   
        if($scope.newThing === '') {
            return;
        }


        $http.post('/api/things', { name: $scope.newThing });
        $scope.newThing = '';
    };

    $scope.deleteThing = function(thing) {
        $http.delete('/api/things/' + thing._id);
    };

    $scope.$on('$destroy', function () {
        socket.unsyncUpdates('thing');


    });



    $http.get('/api/marcas').success(function(marcas) {
        $scope.marcas = marcas;
        socket.syncUpdates('marcas', $scope.response);

        $scope.marcasArr = [];

        $scope.response.forEach(function(value) {
            $scope.marcas.push(value.name);
        });

        $scope.marcaSel = function() {
            for (i = 0; i < $scope.response.length; i++) {
                if ($scope.selectedMarca == $scope.response[i].name) {
                    $scope.modelos = $scope.response[i].modelos;
                };
            };      
        };



    });

0 个答案:

没有答案