Skip to content

Commit 2f150ae

Browse files
authored
Merge pull request #8 from amoldavsky/bug-fixes-01
Bug fixes for 1.0.0
2 parents 7b80953 + 939402a commit 2f150ae

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

src/angular-mocks-async.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
// we ASSUME that when executed this function will return a promise
167167
def.getPromise = response;
168168

169-
} else if( reponse.then && ( typeof reponse.then === 'function' ) ) {
169+
} else if( response.then && ( typeof response.then === 'function' ) ) {
170170

171171
// we got a raw promise, we need to wrap it in a function
172172
def.getPromise = function( method, url, data, headers, keys ) {

test/angular-mocks-async-internal-tests.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,16 @@ var should = chai.should;
9797
})();
9898

9999
//------------------ test matchers:
100-
it('test original data matcher', function (done) {
100+
it( 'test original data matcher', function( done ) {
101101

102102
var payload1 = {
103103
a: 1
104104
};
105105
var payload2 = {
106-
a: 1
106+
2: 2
107107
};
108108

109-
inject(function ($httpBackend, $q, $http) {
109+
inject( function( $httpBackend, $q, $http ) {
110110

111111
done;
112112

@@ -149,7 +149,7 @@ var should = chai.should;
149149
url: 'http://api.example.com/user/11',
150150
data: payload1
151151
}).then(
152-
function success(response) {
152+
function success( response ) {
153153

154154
expect( response ).to.be.a( 'object' );
155155
expect( response ).to.have.property( 'data' );
@@ -161,7 +161,7 @@ var should = chai.should;
161161
done();
162162

163163
},
164-
function error(response) {
164+
function error( response ) {
165165
// mocked response had status 200 but the request failed...
166166
done();
167167
}
@@ -173,7 +173,7 @@ var should = chai.should;
173173
url: 'http://api.example.com/user/11',
174174
data: payload2
175175
}).then(
176-
function success(response) {
176+
function success( response ) {
177177

178178
expect( response ).to.be.a( 'object' );
179179
expect( response ).to.have.property( 'data' );
@@ -184,7 +184,7 @@ var should = chai.should;
184184

185185
done();
186186
},
187-
function error(response) {
187+
function error( response ) {
188188
// mocked response had status 200 but the request failed...
189189
done();
190190
}
@@ -194,22 +194,22 @@ var should = chai.should;
194194
});
195195
});
196196

197-
/* fix this test
198-
it('test our data matcher', function (done) {
197+
/* fix this test */
198+
it( 'test our data matcher', function( done ) {
199199

200200
var payload1 = {
201201
a: 1
202202
};
203203
var payload2 = {
204-
a: 1
204+
b: 2
205205
};
206206

207-
inject(function ($httpBackend, $q, $http) {
207+
inject( function( $httpBackend, $q, $http ) {
208208

209209
done;
210210

211211
// define our HTTP mock 1
212-
$httpBackend.when(
212+
$httpBackend.whenAsync(
213213
'POST',
214214
new RegExp( 'http://api.example.com/user/.+$' ),
215215
payload1
@@ -226,7 +226,7 @@ var should = chai.should;
226226
});
227227

228228
// define our HTTP mock 2
229-
$httpBackend.when(
229+
$httpBackend.whenAsync(
230230
'POST',
231231
new RegExp( 'http://api.example.com/user/.+$' ),
232232
payload2
@@ -247,7 +247,7 @@ var should = chai.should;
247247
url: 'http://api.example.com/user/11',
248248
data: payload1
249249
}).then(
250-
function success(response) {
250+
function success( response ) {
251251

252252
expect( response ).to.be.a( 'object' );
253253
expect( response ).to.have.property( 'data' );
@@ -259,7 +259,7 @@ var should = chai.should;
259259
done();
260260

261261
},
262-
function error(response) {
262+
function error( response ) {
263263
// mocked response had status 200 but the request failed...
264264
done();
265265
}
@@ -291,7 +291,6 @@ var should = chai.should;
291291

292292
});
293293
});
294-
*/
295294

296295
});
297296
})( angular );

0 commit comments

Comments
 (0)