Skip to content

Commit

Permalink
Improve NetworkingEngine test coverage
Browse files Browse the repository at this point in the history
Change-Id: I6c3f6347e3d7e647b48bf8d1a3e7da9d7edf1859
  • Loading branch information
joeyparrish committed Mar 21, 2017
1 parent e50d01e commit b089375
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/net/networking_engine_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,23 @@ describe('NetworkingEngine', /** @suppress {accessControls} */ function() {
done();
});
});

it('fills in defaults for partial request objects', function(done) {
var originalRequest = {
uris: ['resolve://foo']
};

resolveScheme.and.callFake(function(uri, request, requestTypePassed) {
// NetworkingEngine should have filled in these values:
expect(request.method).toBeTruthy();
expect(request.headers).toBeTruthy();
expect(request.retryParameters).toBeTruthy();

return Promise.resolve({});
});
networkingEngine.request(requestType, originalRequest)
.catch(fail).then(done);
});
});

describe('request filter', function() {
Expand Down Expand Up @@ -480,6 +497,11 @@ describe('NetworkingEngine', /** @suppress {accessControls} */ function() {
})
.then(done);
});

it('causes no errors to remove an unused filter', function() {
var unusedFilter = jasmine.createSpy('unused filter');
networkingEngine.unregisterRequestFilter(unusedFilter);
});
});

describe('response filter', function() {
Expand Down Expand Up @@ -647,6 +669,11 @@ describe('NetworkingEngine', /** @suppress {accessControls} */ function() {
done();
});
});

it('causes no errors to remove an unused filter', function() {
var unusedFilter = jasmine.createSpy('unused filter');
networkingEngine.unregisterResponseFilter(unusedFilter);
});
});

describe('destroy', function() {
Expand Down

0 comments on commit b089375

Please sign in to comment.