From c065246a230ed3fe1be5e1ea08a20698f0208687 Mon Sep 17 00:00:00 2001 From: mleanos Date: Wed, 5 Oct 2016 16:04:22 -0700 Subject: [PATCH] Update path in tests Updated tests to account for new "/" prefix in the path. --- .../config/articles-admin.client.routes.js | 8 +++--- .../admin.articles.client.controller.tests.js | 4 +-- .../admin.articles.client.routes.tests.js | 10 +++---- ...n.list.articles.client.controller.tests.js | 2 +- .../client/articles.client.routes.tests.js | 2 +- .../tests/client/chat.client.routes.tests.js | 4 +-- .../client/services/users.client.service.js | 12 ++++----- .../change-profile-picture.client.view.html | 2 +- .../authentication.client.controller.tests.js | 12 ++++----- .../password.client.controller.tests.js | 8 +++--- .../client/users-admin.client.routes.tests.js | 8 +++--- .../tests/client/users.client.routes.tests.js | 26 +++++++++---------- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/modules/articles/client/config/articles-admin.client.routes.js b/modules/articles/client/config/articles-admin.client.routes.js index b15d918c30..db45758c12 100644 --- a/modules/articles/client/config/articles-admin.client.routes.js +++ b/modules/articles/client/config/articles-admin.client.routes.js @@ -15,8 +15,8 @@ template: '' }) .state('admin.articles.list', { - url: '', - templateUrl: 'modules/articles/client/views/admin/list-articles.client.view.html', + url: '/', + templateUrl: '/modules/articles/client/views/admin/list-articles.client.view.html', controller: 'ArticlesAdminListController', controllerAs: 'vm', data: { @@ -25,7 +25,7 @@ }) .state('admin.articles.create', { url: '/create', - templateUrl: 'modules/articles/client/views/admin/form-article.client.view.html', + templateUrl: '/modules/articles/client/views/admin/form-article.client.view.html', controller: 'ArticlesAdminController', controllerAs: 'vm', data: { @@ -37,7 +37,7 @@ }) .state('admin.articles.edit', { url: '/:articleId/edit', - templateUrl: 'modules/articles/client/views/admin/form-article.client.view.html', + templateUrl: '/modules/articles/client/views/admin/form-article.client.view.html', controller: 'ArticlesAdminController', controllerAs: 'vm', data: { diff --git a/modules/articles/tests/client/admin.articles.client.controller.tests.js b/modules/articles/tests/client/admin.articles.client.controller.tests.js index 52b206e43e..235a32c93f 100644 --- a/modules/articles/tests/client/admin.articles.client.controller.tests.js +++ b/modules/articles/tests/client/admin.articles.client.controller.tests.js @@ -87,7 +87,7 @@ it('should send a POST request with the form input values and then locate to new object URL', inject(function (ArticlesService) { // Set POST response - $httpBackend.expectPOST('api/articles', sampleArticlePostData).respond(mockArticle); + $httpBackend.expectPOST('/api/articles', sampleArticlePostData).respond(mockArticle); // Run controller functionality $scope.vm.save(true); @@ -101,7 +101,7 @@ it('should call Notification.error if error', function () { var errorMessage = 'this is an error message'; - $httpBackend.expectPOST('api/articles', sampleArticlePostData).respond(400, { + $httpBackend.expectPOST('/api/articles', sampleArticlePostData).respond(400, { message: errorMessage }); diff --git a/modules/articles/tests/client/admin.articles.client.routes.tests.js b/modules/articles/tests/client/admin.articles.client.routes.tests.js index e699ae45e1..0a7873e4fe 100644 --- a/modules/articles/tests/client/admin.articles.client.routes.tests.js +++ b/modules/articles/tests/client/admin.articles.client.routes.tests.js @@ -53,7 +53,7 @@ }); it('Should have templateUrl', function () { - expect(liststate.templateUrl).toBe('modules/articles/client/views/admin/list-articles.client.view.html'); + expect(liststate.templateUrl).toBe('/modules/articles/client/views/admin/list-articles.client.view.html'); }); }); @@ -64,7 +64,7 @@ beforeEach(inject(function ($controller, $state, $templateCache) { createstate = $state.get('admin.articles.create'); - $templateCache.put('modules/articles/client/views/admin/form-article.client.view.html', ''); + $templateCache.put('/modules/articles/client/views/admin/form-article.client.view.html', ''); // Create mock article mockArticle = new ArticlesService(); @@ -99,7 +99,7 @@ }); it('Should have templateUrl', function () { - expect(createstate.templateUrl).toBe('modules/articles/client/views/admin/form-article.client.view.html'); + expect(createstate.templateUrl).toBe('/modules/articles/client/views/admin/form-article.client.view.html'); }); }); @@ -110,7 +110,7 @@ beforeEach(inject(function ($controller, $state, $templateCache) { editstate = $state.get('admin.articles.edit'); - $templateCache.put('modules/articles/client/views/admin/form-article.client.view.html', ''); + $templateCache.put('/modules/articles/client/views/admin/form-article.client.view.html', ''); // Create mock article mockArticle = new ArticlesService({ @@ -150,7 +150,7 @@ }); it('Should have templateUrl', function () { - expect(editstate.templateUrl).toBe('modules/articles/client/views/admin/form-article.client.view.html'); + expect(editstate.templateUrl).toBe('/modules/articles/client/views/admin/form-article.client.view.html'); }); xit('Should go to unauthorized route', function () { diff --git a/modules/articles/tests/client/admin.list.articles.client.controller.tests.js b/modules/articles/tests/client/admin.list.articles.client.controller.tests.js index e4e99dbb13..d22f13a211 100644 --- a/modules/articles/tests/client/admin.list.articles.client.controller.tests.js +++ b/modules/articles/tests/client/admin.list.articles.client.controller.tests.js @@ -76,7 +76,7 @@ it('should send a GET request and return all articles', inject(function (ArticlesService) { // Set POST response - $httpBackend.expectGET('api/articles').respond(mockArticleList); + $httpBackend.expectGET('/api/articles').respond(mockArticleList); $httpBackend.flush(); diff --git a/modules/articles/tests/client/articles.client.routes.tests.js b/modules/articles/tests/client/articles.client.routes.tests.js index 4fa7cae1e2..5171226dae 100644 --- a/modules/articles/tests/client/articles.client.routes.tests.js +++ b/modules/articles/tests/client/articles.client.routes.tests.js @@ -53,7 +53,7 @@ }); it('Should have templateUrl', function () { - expect(liststate.templateUrl).toBe('modules/articles/client/views/list-articles.client.view.html'); + expect(liststate.templateUrl).toBe('/modules/articles/client/views/list-articles.client.view.html'); }); }); diff --git a/modules/chat/tests/client/chat.client.routes.tests.js b/modules/chat/tests/client/chat.client.routes.tests.js index bbd447eee1..47827db778 100644 --- a/modules/chat/tests/client/chat.client.routes.tests.js +++ b/modules/chat/tests/client/chat.client.routes.tests.js @@ -34,7 +34,7 @@ }); it('Should have templateUrl', function () { - expect(mainstate.templateUrl).toBe('modules/chat/client/views/chat.client.view.html'); + expect(mainstate.templateUrl).toBe('/modules/chat/client/views/chat.client.view.html'); }); }); @@ -54,7 +54,7 @@ $rootScope.$digest(); expect($location.path()).toBe('/chat'); - expect($state.current.templateUrl).toBe('modules/chat/client/views/chat.client.view.html'); + expect($state.current.templateUrl).toBe('/modules/chat/client/views/chat.client.view.html'); })); }); diff --git a/modules/users/client/services/users.client.service.js b/modules/users/client/services/users.client.service.js index 228b73385a..dd51119448 100644 --- a/modules/users/client/services/users.client.service.js +++ b/modules/users/client/services/users.client.service.js @@ -15,30 +15,30 @@ }, updatePassword: { method: 'POST', - url: 'api/users/password' + url: '/api/users/password' }, deleteProvider: { method: 'DELETE', - url: 'api/users/accounts', + url: '/api/users/accounts', params: { provider: '@provider' } }, sendPasswordResetToken: { method: 'POST', - url: 'api/auth/forgot' + url: '/api/auth/forgot' }, resetPasswordWithToken: { method: 'POST', - url: 'api/auth/reset/:token' + url: '/api/auth/reset/:token' }, signup: { method: 'POST', - url: 'api/auth/signup' + url: '/api/auth/signup' }, signin: { method: 'POST', - url: 'api/auth/signin' + url: '/api/auth/signin' } }); diff --git a/modules/users/client/views/settings/change-profile-picture.client.view.html b/modules/users/client/views/settings/change-profile-picture.client.view.html index 0e4fccc8a9..a277dcd6db 100644 --- a/modules/users/client/views/settings/change-profile-picture.client.view.html +++ b/modules/users/client/views/settings/change-profile-picture.client.view.html @@ -9,7 +9,7 @@
- +
diff --git a/modules/users/tests/client/authentication.client.controller.tests.js b/modules/users/tests/client/authentication.client.controller.tests.js index dbbbd5b091..572abe9b48 100644 --- a/modules/users/tests/client/authentication.client.controller.tests.js +++ b/modules/users/tests/client/authentication.client.controller.tests.js @@ -56,7 +56,7 @@ describe('$scope.signin()', function () { it('should login with a correct username and password', function () { // Test expected GET request - $httpBackend.when('POST', 'api/auth/signin').respond(200, { username: 'Fred' }); + $httpBackend.when('POST', '/api/auth/signin').respond(200, { username: 'Fred' }); scope.vm.signin(true); $httpBackend.flush(); @@ -93,7 +93,7 @@ spyOn($state, 'go'); // Test expected GET request - $httpBackend.when('POST', 'api/auth/signin').respond(200, 'Fred'); + $httpBackend.when('POST', '/api/auth/signin').respond(200, 'Fred'); scope.vm.signin(true); $httpBackend.flush(); @@ -106,7 +106,7 @@ it('should fail to log in with nothing', function () { // Test expected POST request - $httpBackend.expectPOST('api/auth/signin').respond(400, { + $httpBackend.expectPOST('/api/auth/signin').respond(400, { 'message': 'Missing credentials' }); @@ -123,7 +123,7 @@ scope.vm.credentials = 'Bar'; // Test expected POST request - $httpBackend.expectPOST('api/auth/signin').respond(400, { + $httpBackend.expectPOST('/api/auth/signin').respond(400, { 'message': 'Unknown user' }); @@ -139,7 +139,7 @@ it('should register with correct data', function () { // Test expected GET request scope.vm.authentication.user = 'Fred'; - $httpBackend.when('POST', 'api/auth/signup').respond(200, { username: 'Fred' }); + $httpBackend.when('POST', '/api/auth/signup').respond(200, { username: 'Fred' }); scope.vm.signup(true); $httpBackend.flush(); @@ -152,7 +152,7 @@ it('should fail to register with duplicate Username', function () { // Test expected POST request - $httpBackend.when('POST', 'api/auth/signup').respond(400, { + $httpBackend.when('POST', '/api/auth/signup').respond(400, { 'message': 'Username already exists' }); diff --git a/modules/users/tests/client/password.client.controller.tests.js b/modules/users/tests/client/password.client.controller.tests.js index fc8637cd78..da4f61b855 100644 --- a/modules/users/tests/client/password.client.controller.tests.js +++ b/modules/users/tests/client/password.client.controller.tests.js @@ -96,7 +96,7 @@ describe('POST error', function() { var errorMessage = 'No account with that username has been found'; beforeEach(function() { - $httpBackend.when('POST', 'api/auth/forgot', credentials).respond(400, { + $httpBackend.when('POST', '/api/auth/forgot', credentials).respond(400, { 'message': errorMessage }); @@ -116,7 +116,7 @@ describe('POST success', function() { var successMessage = 'An email has been sent to the provided email with further instructions.'; beforeEach(function() { - $httpBackend.when('POST', 'api/auth/forgot', credentials).respond({ + $httpBackend.when('POST', '/api/auth/forgot', credentials).respond({ 'message': successMessage }); @@ -146,7 +146,7 @@ it('POST error should call Notification.error with response message', function() { var errorMessage = 'Passwords do not match'; - $httpBackend.when('POST', 'api/auth/reset/' + token, passwordDetails).respond(400, { + $httpBackend.when('POST', '/api/auth/reset/' + token, passwordDetails).respond(400, { 'message': errorMessage }); @@ -161,7 +161,7 @@ username: 'test' }; beforeEach(function() { - $httpBackend.when('POST', 'api/auth/reset/' + token, passwordDetails).respond(user); + $httpBackend.when('POST', '/api/auth/reset/' + token, passwordDetails).respond(user); scope.vm.resetUserPassword(true); $httpBackend.flush(); diff --git a/modules/users/tests/client/users-admin.client.routes.tests.js b/modules/users/tests/client/users-admin.client.routes.tests.js index e462f66349..996e6470b1 100644 --- a/modules/users/tests/client/users-admin.client.routes.tests.js +++ b/modules/users/tests/client/users-admin.client.routes.tests.js @@ -34,7 +34,7 @@ }); it('Should have templateUrl', function () { - expect(mainstate.templateUrl).toBe('modules/users/client/views/admin/list-users.client.view.html'); + expect(mainstate.templateUrl).toBe('/modules/users/client/views/admin/list-users.client.view.html'); }); }); @@ -53,7 +53,7 @@ }); it('Should have templateUrl', function () { - expect(viewstate.templateUrl).toBe('modules/users/client/views/admin/view-user.client.view.html'); + expect(viewstate.templateUrl).toBe('/modules/users/client/views/admin/view-user.client.view.html'); }); }); @@ -72,7 +72,7 @@ }); it('Should have templateUrl', function () { - expect(editstate.templateUrl).toBe('modules/users/client/views/admin/edit-user.client.view.html'); + expect(editstate.templateUrl).toBe('/modules/users/client/views/admin/edit-user.client.view.html'); }); }); @@ -92,7 +92,7 @@ $rootScope.$digest(); expect($location.path()).toBe('/admin/users'); - expect($state.current.templateUrl).toBe('modules/users/client/views/admin/list-users.client.view.html'); + expect($state.current.templateUrl).toBe('/modules/users/client/views/admin/list-users.client.view.html'); })); }); diff --git a/modules/users/tests/client/users.client.routes.tests.js b/modules/users/tests/client/users.client.routes.tests.js index daf21c2c59..75f9e11dd4 100644 --- a/modules/users/tests/client/users.client.routes.tests.js +++ b/modules/users/tests/client/users.client.routes.tests.js @@ -34,7 +34,7 @@ }); it('Should have templateUrl', function () { - expect(mainstate.templateUrl).toBe('modules/users/client/views/settings/settings.client.view.html'); + expect(mainstate.templateUrl).toBe('/modules/users/client/views/settings/settings.client.view.html'); }); }); @@ -53,7 +53,7 @@ }); it('Should have templateUrl', function () { - expect(profilestate.templateUrl).toBe('modules/users/client/views/settings/edit-profile.client.view.html'); + expect(profilestate.templateUrl).toBe('/modules/users/client/views/settings/edit-profile.client.view.html'); }); }); @@ -72,7 +72,7 @@ }); it('Should have templateUrl', function () { - expect(passwordstate.templateUrl).toBe('modules/users/client/views/settings/change-password.client.view.html'); + expect(passwordstate.templateUrl).toBe('/modules/users/client/views/settings/change-password.client.view.html'); }); }); @@ -91,7 +91,7 @@ }); it('Should have templateUrl', function () { - expect(accountsstate.templateUrl).toBe('modules/users/client/views/settings/manage-social-accounts.client.view.html'); + expect(accountsstate.templateUrl).toBe('/modules/users/client/views/settings/manage-social-accounts.client.view.html'); }); }); @@ -110,7 +110,7 @@ }); it('Should have templateUrl', function () { - expect(picturestate.templateUrl).toBe('modules/users/client/views/settings/change-profile-picture.client.view.html'); + expect(picturestate.templateUrl).toBe('/modules/users/client/views/settings/change-profile-picture.client.view.html'); }); }); @@ -130,7 +130,7 @@ $rootScope.$digest(); expect($location.path()).toBe('/settings/profile'); - expect($state.current.templateUrl).toBe('modules/users/client/views/settings/edit-profile.client.view.html'); + expect($state.current.templateUrl).toBe('/modules/users/client/views/settings/edit-profile.client.view.html'); })); }); @@ -152,7 +152,7 @@ }); it('Should have templateUrl', function () { - expect(mainstate.templateUrl).toBe('modules/users/client/views/authentication/authentication.client.view.html'); + expect(mainstate.templateUrl).toBe('/modules/users/client/views/authentication/authentication.client.view.html'); }); }); @@ -171,7 +171,7 @@ }); it('Should have templateUrl', function () { - expect(signupstate.templateUrl).toBe('modules/users/client/views/authentication/signup.client.view.html'); + expect(signupstate.templateUrl).toBe('/modules/users/client/views/authentication/signup.client.view.html'); }); }); @@ -190,7 +190,7 @@ }); it('Should have templateUrl', function () { - expect(signinstate.templateUrl).toBe('modules/users/client/views/authentication/signin.client.view.html'); + expect(signinstate.templateUrl).toBe('/modules/users/client/views/authentication/signin.client.view.html'); }); }); @@ -231,7 +231,7 @@ }); it('Should have templateUrl', function () { - expect(forgotstate.templateUrl).toBe('modules/users/client/views/password/forgot-password.client.view.html'); + expect(forgotstate.templateUrl).toBe('/modules/users/client/views/password/forgot-password.client.view.html'); }); }); @@ -272,7 +272,7 @@ }); it('Should have templateUrl', function () { - expect(invalidstate.templateUrl).toBe('modules/users/client/views/password/reset-password-invalid.client.view.html'); + expect(invalidstate.templateUrl).toBe('/modules/users/client/views/password/reset-password-invalid.client.view.html'); }); }); @@ -291,7 +291,7 @@ }); it('Should have templateUrl', function () { - expect(successstate.templateUrl).toBe('modules/users/client/views/password/reset-password-success.client.view.html'); + expect(successstate.templateUrl).toBe('/modules/users/client/views/password/reset-password-success.client.view.html'); }); }); @@ -310,7 +310,7 @@ }); it('Should have templateUrl', function () { - expect(formstate.templateUrl).toBe('modules/users/client/views/password/reset-password.client.view.html'); + expect(formstate.templateUrl).toBe('/modules/users/client/views/password/reset-password.client.view.html'); }); });