mardi 3 octobre 2017

How this code can be abstracted and fixed?

How can this part of code be abstracted? Maybe it is posible to declare this variables somewhere else? I tried all i think but didnt make it:(

Part to fix:

 var $scope = {};
            var controller = $controller('topCtrl', {
                $scope: $scope
            });

All code:

describe('test', function () {
    beforeEach(module('app'));
    var first, second,$controller;
    beforeEach(inject(function (_$controller_, firstServ, secondServ) {
        $controller = _$controller_;
        first =  firstServ;
        second = secondServ;
    }));
    describe('submit function', function () {
        it('defin', function () {
            var $scope = {};
            var controller = $controller('topCtrl', {
                $scope: $scope
            });
            expect($scope.data).toBeDefined();
        });
    });
});

Aucun commentaire:

Enregistrer un commentaire