|
56 | 56 | describe('$scope.signin()', function () {
|
57 | 57 | it('should login with a correct username and password', function () {
|
58 | 58 | // Test expected GET request
|
59 |
| - $httpBackend.when('POST', 'api/auth/signin').respond(200, { username: 'Fred' }); |
| 59 | + $httpBackend.when('POST', '/api/auth/signin').respond(200, { username: 'Fred' }); |
60 | 60 |
|
61 | 61 | scope.vm.signin(true);
|
62 | 62 | $httpBackend.flush();
|
|
93 | 93 | spyOn($state, 'go');
|
94 | 94 |
|
95 | 95 | // Test expected GET request
|
96 |
| - $httpBackend.when('POST', 'api/auth/signin').respond(200, 'Fred'); |
| 96 | + $httpBackend.when('POST', '/api/auth/signin').respond(200, 'Fred'); |
97 | 97 |
|
98 | 98 | scope.vm.signin(true);
|
99 | 99 | $httpBackend.flush();
|
|
106 | 106 |
|
107 | 107 | it('should fail to log in with nothing', function () {
|
108 | 108 | // Test expected POST request
|
109 |
| - $httpBackend.expectPOST('api/auth/signin').respond(400, { |
| 109 | + $httpBackend.expectPOST('/api/auth/signin').respond(400, { |
110 | 110 | 'message': 'Missing credentials'
|
111 | 111 | });
|
112 | 112 |
|
|
123 | 123 | scope.vm.credentials = 'Bar';
|
124 | 124 |
|
125 | 125 | // Test expected POST request
|
126 |
| - $httpBackend.expectPOST('api/auth/signin').respond(400, { |
| 126 | + $httpBackend.expectPOST('/api/auth/signin').respond(400, { |
127 | 127 | 'message': 'Unknown user'
|
128 | 128 | });
|
129 | 129 |
|
|
139 | 139 | it('should register with correct data', function () {
|
140 | 140 | // Test expected GET request
|
141 | 141 | scope.vm.authentication.user = 'Fred';
|
142 |
| - $httpBackend.when('POST', 'api/auth/signup').respond(200, { username: 'Fred' }); |
| 142 | + $httpBackend.when('POST', '/api/auth/signup').respond(200, { username: 'Fred' }); |
143 | 143 |
|
144 | 144 | scope.vm.signup(true);
|
145 | 145 | $httpBackend.flush();
|
|
152 | 152 |
|
153 | 153 | it('should fail to register with duplicate Username', function () {
|
154 | 154 | // Test expected POST request
|
155 |
| - $httpBackend.when('POST', 'api/auth/signup').respond(400, { |
| 155 | + $httpBackend.when('POST', '/api/auth/signup').respond(400, { |
156 | 156 | 'message': 'Username already exists'
|
157 | 157 | });
|
158 | 158 |
|
|
0 commit comments