mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 03:30:02 +08:00
feat($httpBackend): add expect/when shortcut methods
This commit is contained in:
15
test/angular-mocksSpec.js
vendored
15
test/angular-mocksSpec.js
vendored
@@ -750,6 +750,21 @@ describe('mocks', function() {
|
||||
});
|
||||
|
||||
|
||||
describe('expect/when shorcuts', function() {
|
||||
angular.forEach(['expect', 'when'], function(prefix) {
|
||||
angular.forEach(['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'JSONP'], function(method) {
|
||||
var shortcut = prefix + method;
|
||||
it('should provide ' + shortcut + ' shortcut method', function() {
|
||||
hb[shortcut]('/foo').respond('bar');
|
||||
hb(method, '/foo', undefined, callback);
|
||||
hb.flush();
|
||||
expect(callback).toHaveBeenCalledOnceWith(200, 'bar', '');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('MockHttpExpectation', function() {
|
||||
|
||||
it('should accept url as regexp', function() {
|
||||
|
||||
Reference in New Issue
Block a user