<commit_before>define(['baseTestSetup', 'angular'], function(baseTestSetup, angular) {
    'use strict';
    describe('trackr.administration.controllers.projects.new', function() {
        var NewController, scope;
        baseTestSetup();
        beforeEach(inject(function($controller, $rootScope) {
            scope = $rootScope.$new();
            NewController = $controller('trackr.administration.controllers.projects.new', {
                $scope: scope,
                //for now mocked here
                //TODO: find out why the provider is not available
                $modalInstance: {
                    dismiss: angular.noop,
                    close: angular.noop
                }
            });
        }));

        it('must have an errors object', function() {
            expect(scope.errors).toBeDefined();
        });

        it('must have a new company object', function() {
            expect(scope.project).toBeDefined();
        });

        it('must save the company and address', inject(function($httpBackend) {
            scope.saveProject();
            $httpBackend.expectPOST('api/projects');
            $httpBackend.flush();
        }));
    });
});<commit_msg>TRACKR-28 - Write more Javascript tests Finished test for new project controller<commit_after>define(['baseTestSetup', 'angular'], function(baseTestSetup, angular) {
    'use strict';
    describe('trackr.administration.controllers.projects.new', function() {
        var NewController, scope;
        baseTestSetup();
        beforeEach(inject(function($controller, $rootScope) {
            scope = $rootScope.$new();
            NewController = $controller('trackr.administration.controllers.projects.new', {
                $scope: scope,
                //for now mocked here
                //TODO: find out why the provider is not available
                $modalInstance: {
                    dismiss: angular.noop,
                    close: angular.noop
                }
            });
        }));

        it('must have an errors object', function() {
            expect(scope.errors).toBeDefined();
        });

        it('must have a new company object', function() {
            expect(scope.project).toBeDefined();
        });

        it('Must save the project.', inject(function($httpBackend) {
            var company = {_links: {self: {href: 'api/companies/0'}}};
            scope.saveProject(company, company);
            $httpBackend.expectPOST('api/projects');
            $httpBackend.flush();
        }));

        it('Must search for companies in the backend', inject(function($httpBackend) {
            scope.getCompanies('test');
            $httpBackend.expectGET(/api\/companies\/search\/findByNameLikeOrderByNameAsc\?.*/);
            $httpBackend.flush();
        }));
    });
});
{'fraction_non_alphanumeric': 0.13101983002832862, 'fraction_numerical': 0.0010623229461756375, 'mean_word_length': 1.9989384288747345, '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': '6078954', 'n_tokens_mistral': 715, 'n_tokens_neox': 695, 'n_words': 152}