Skip to content

Commit

Permalink
add a test for the redirect controller
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Sep 24, 2016
1 parent 78eb8b1 commit c90c53e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pathway/static/js/pathway/app.js
Expand Up @@ -23,7 +23,7 @@ OPAL.run(app);
app.config(function($routeProvider){
$routeProvider
.when('/', {
controller: 'PathwayRedirectController',
controller: 'PathwayRedirectCtrl',
resolve: {},
templateUrl: '/templates/loading_page.html'
})
Expand Down
2 changes: 1 addition & 1 deletion pathway/static/js/pathway/controllers/pathway_redirect.js
@@ -1,3 +1,3 @@
angular.module('opal.controllers').controller('PathwayRedirectController', function($window){
angular.module('opal.controllers').controller('PathwayRedirectCtrl', function($window){
$window.location.href="/";
});
19 changes: 19 additions & 0 deletions pathway/static/js/pathwaytest/pathway_redirect.controller.test.js
@@ -0,0 +1,19 @@
describe("PathwayRedirectCtrl", function(){
"use strict";
var controller, $controller, fakeWindow;
beforeEach(function(){
module('opal.controllers');
inject(function($injector){
$controller = $injector.get('$controller')
});
fakeWindow = {location: {href: undefined}}
controller = $controller("PathwayRedirectCtrl", {
$window: fakeWindow
});
});

it("should redirect to the root url", function(){
expect(fakeWindow.location.href).toBe("/")
});

});

0 comments on commit c90c53e

Please sign in to comment.