{"size": 1083, "ext": "js", "max_stars_repo_path": "test/modules/base/controllers/navigationSpec.js", "max_stars_repo_name": "techdev-solutions/trackr-frontend", "max_stars_repo_stars_event_min_datetime": "2015-01-01T13:38:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-25T13:36:57.000Z", "max_issues_repo_path": "test/modules/base/controllers/navigationSpec.js", "max_issues_repo_name": "techdev-solutions/trackr-frontend", "max_issues_repo_issues_event_min_datetime": "2015-05-30T12:58:55.000Z", "max_issues_repo_issues_event_max_datetime": "2017-02-17T15:25:24.000Z", "max_forks_repo_path": "test/modules/base/controllers/navigationSpec.js", "max_forks_repo_name": "techdev-solutions/trackr-frontend", "max_forks_repo_forks_event_min_datetime": "2015-01-02T20:41:08.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-21T12:50:06.000Z"}
{"max_stars_count": 112, "max_issues_count": 11, "max_forks_count": 71, "avg_line_length": 37.3448275862, "max_line_length": 100, "alphanum_fraction": 0.5863342567}
define(['baseTestSetup'], function(baseTestSetup) {
    'use strict';
    describe('base.controllers.navigation', function () {
        var NavigationController, scope, UserService;

        baseTestSetup();
        beforeEach(inject(function($rootScope, $controller, $injector) {
            scope = $rootScope.$new();
            UserService = $injector.get('base.services.user');
            spyOn(UserService, 'getUser').andCallThrough();
            NavigationController = $controller('base.controllers.navigation', {
                $scope: scope
            });
        }));

        it('should put the active user into scope', inject(function($httpBackend) {
            $httpBackend.flush();
            expect(UserService.getUser).toHaveBeenCalled();
            expect(scope.user).toBeDefined();
        }));

        it('changeLanguage should perform a put request on the API', inject(function($httpBackend) {
            scope.changeLanguage('en');
            $httpBackend.expectPUT(/^api\/translations\?.*/);
            $httpBackend.flush();
        }));
    });
});
