<commit_before>
describe('loginCtrl', function () {
    var $rootScope, $scope, store, $state, stateMock, createController, auth, $ionicHistory, $http, $httpBackend, $controller;


    beforeEach(module('app'));
    beforeEach(inject(function ($injector) {

        $rootScope = $injector.get('$rootScope');
        $scope = $rootScope.$new();
        store = $injector.get('store');
        auth  = $injector.get('auth');
        $ionicHistory = $injector.get('$ionicHistory');
        $http = $injector.get('$http');
        $httpBackend = $injector.get('$httpBackend');
        $controller = $injector.get('$controller');
        stateMock = jasmine.createSpyObj('$state spy', ['go']);

        createController = function () {
          return $controller('loginCtrl', {
            $rootScope: $rootScope,
            $scope: $scope,
            store: store,
            auth: auth,
            $ionicHistory: $ionicHistory,
            $http: $http,
            $state: stateMock
          });
        };
    }));
  describe('#login', function() {


    it('should have a login method on the $scope', function () {
        createController();
        expect(typeof $scope.login).toEqual('function');
    });

    it('if successful, should change to state to main', function() {
        createController();

        expect(stateMock.go).toHaveBeenCalledWith();
    });
  });


    it('should have a logout method on the $scope', function () {
        createController();
        expect(typeof $scope.logout).toEqual('function');
    });
});
<commit_msg>(chore) Working on spys<commit_after>
describe('loginCtrl', function () {
    var $rootScope, $scope, store, $state, createController, auth, Auth,$ionicHistory, $http, $httpBackend, $controller;


    beforeEach(module('app'));
    beforeEach(inject(function ($injector) {

        $rootScope = $injector.get('$rootScope');
        $scope = $rootScope.$new();
        store = $injector.get('store');
        auth  = $injector.get('auth');
        $ionicHistory = $injector.get('$ionicHistory');
        $http = $injector.get('$http');
        $httpBackend = $injector.get('$httpBackend');
        $controller = $injector.get('$controller');
        $state = $injector.get('$state');
        Auth = $injector.get('Auth');

        createController = function () {
          return $controller('loginCtrl', {
            $rootScope: $rootScope,
            $scope: $scope,
            store: store,
            auth: auth,
            $ionicHistory: $ionicHistory,
            $http: $http,
            $state: $state,
            Auth: Auth
          });
        };
    }));
  describe('#login', function() {


    it('should have a login method on the $scope', function () {
        createController();
        expect(typeof $scope.login).toEqual('function');
    });

    it('if successful, should change to state to main', function() {
        createController();
        spyOn($state, '$scope.login')
        expect($state.go).toHaveBeenCalledWith('main');
    });
  });


    it('should have a logout method on the $scope', function () {
        createController();
        expect(typeof $scope.logout).toEqual('function');
    });
});

{'fraction_non_alphanumeric': 0.16411378555798686, 'fraction_numerical': 0.0, 'mean_word_length': 2.5437430786267994, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7641762', 'n_tokens_mistral': 912, 'n_tokens_neox': 894, 'n_words': 192}