test/javascript/src/app_test.js in puppet-herald-0.2.0 vs test/javascript/src/app_test.js in puppet-herald-0.8.0
- old
+ new
@@ -11,80 +11,29 @@
controller = $controller('AppController', { $scope: scope });
Page = _Page_;
}));
it('should have a `null` as page set by default', function() {
- expect(controller.page).toEqual(null);
+ expect(scope.page).toEqual(null);
});
- it('should have a ("Nodes", null) as page set, if Page.title("Nodes") was called before', function() {
+ it('should have ("Nodes", null), after Page.title("Nodes") call', function() {
Page.title('Nodes');
- expect(controller.page).toEqual("Nodes");
- expect(controller.target).toEqual(undefined);
+ expect(scope.page).toEqual("Nodes");
+ expect(scope.target).toEqual(undefined);
});
- it('should have a ("Report", 1234567) as page set, if Page.title("Report", 1234567) was called before', function() {
+ it('should have ("Report", 1234567), after Page.title("Report", 1234567) call', function() {
Page.title('Report', 1234567);
- expect(controller.page).toEqual("Report");
- expect(controller.target).toEqual(1234567);
+ expect(scope.page).toEqual("Report");
+ expect(scope.target).toEqual(1234567);
});
- it('should have a ("Node", "master") as page set, if Page.title("Node", "master", " - ") was called before', function() {
+ it('should have ("Node", "master"), after Page.title("Node", "master", " - ") call', function() {
Page.title('Node', "master", ' - ');
- expect(controller.page).toEqual("Node");
- expect(controller.target).toEqual('master');
+ expect(scope.page).toEqual("Node");
+ expect(scope.target).toEqual('master');
});
});
- describe('routes mapping', function() {
-
- var $route, $location, $rootScope, navigateTo;
- beforeEach(module('nodes/nodes.html'));
- beforeEach(module('node/node.html'));
- beforeEach(module('report/report.html'));
- beforeEach(inject(function(_$route_, _$location_, _$rootScope_) {
- $route = _$route_;
- $location = _$location_;
- $rootScope = _$rootScope_;
- navigateTo = function(address) {
- expect($route.current).toBeUndefined();
- $location.path(address);
- $rootScope.$digest();
- };
- }));
-
- it('should map NodesController for unknown address', function() {
- expect($route.routes[null].redirectTo).toEqual('/nodes');
- });
- it('should map NodesController if given "/nodes"', function() {
- expect($route.routes['/nodes'].controller).toBe('NodesController');
- });
-
- it('should navigate to "/nodes" if given "/" a address', function() {
- navigateTo('/');
- expect($route.current.controller).toBe('NodesController');
- expect($route.current.originalPath).toBe('/nodes');
- });
-
- it('should navigate to "/nodes" if given "/non-existing-link-0" a address', function() {
- navigateTo('/non-existing-link-0');
- expect($route.current.controller).toBe('NodesController');
- expect($route.current.originalPath).toBe('/nodes');
- });
-
- it('should navigate to "/node/1" if given "/node/1" a address', function() {
- navigateTo('/node/1');
- expect($route.current.controller).toBe('NodeController');
- expect($route.current.originalPath).toBe('/node/:nodeId');
- expect($route.current.pathParams.nodeId).toBe('1');
- });
-
- it('should navigate to "/report/1" if given "/report/1" a address', function() {
- navigateTo('/report/1');
- expect($route.current.controller).toBe('ReportController');
- expect($route.current.originalPath).toBe('/report/:reportId');
- expect($route.current.pathParams.reportId).toBe('1');
- });
-
- });
});
\ No newline at end of file