Skip to content

Commit

Permalink
Update path in tests
Browse files Browse the repository at this point in the history
Updated tests to account for new "/" prefix in the path.
  • Loading branch information
mleanos committed Oct 10, 2016
1 parent aebaf2f commit c065246
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
template: '<ui-view/>'
})
.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: {
Expand All @@ -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: {
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand All @@ -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();
Expand Down Expand Up @@ -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');
});
});

Expand All @@ -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({
Expand Down Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand Down
4 changes: 2 additions & 2 deletions modules/chat/tests/client/chat.client.routes.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand All @@ -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');
}));
});

Expand Down
12 changes: 6 additions & 6 deletions modules/users/client/services/users.client.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</div>
</div>
<div class="form-group text-center">
<img ng-src="{{vm.fileSelected ? croppedDataUrl : vm.user.profileImageURL}}" alt="{{vm.user.displayName}}" class="img-thumbnail user-profile-picture" ngf-drop>
<img ng-src="{{vm.fileSelected ? croppedDataUrl : '/' + vm.user.profileImageURL}}" alt="{{vm.user.displayName}}" class="img-thumbnail user-profile-picture" ngf-drop>
</div>
<div ng-show="!vm.fileSelected" class="text-center form-group">
<button class="btn btn-default btn-file" ngf-select="vm.fileSelected = true" ng-model="picFile" accept="image/*">Select Picture</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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'
});

Expand All @@ -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'
});

Expand All @@ -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();
Expand All @@ -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'
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
});

Expand All @@ -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
});

Expand Down Expand Up @@ -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
});

Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions modules/users/tests/client/users-admin.client.routes.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand All @@ -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');
});
});

Expand All @@ -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');
});
});

Expand All @@ -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');
}));
});

Expand Down
Loading

0 comments on commit c065246

Please sign in to comment.