Skip to content

Commit

Permalink
Add tests for calling interceptors only once when using passThrough
Browse files Browse the repository at this point in the history
  • Loading branch information
ctimmerm committed Jul 2, 2019
1 parent 082020c commit f32cf15
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/pass_through.spec.js
Expand Up @@ -124,4 +124,37 @@ describe('passThrough tests (requires Node)', function() {
expect(response.data).to.equal('http://null/test/foo');
});
});

it('handles request transformations properly', function() {
mock.onGet('/foo').passThrough();

return instance
.get('/foo', {
data: 'foo',
transformRequest: [
function(data) {
return data + 'foo';
}
]
})
.then(function(response) {
expect(response.config.data).to.equal('foofoo');
});
});

it('handles response transformations properly', function() {
mock.onGet('/foo').passThrough();

return instance
.get('/foo', {
transformResponse: [
function(data) {
return data + 'foo';
}
]
})
.then(function(response) {
expect(response.data).to.equal('/foofoo');
});
});
});

0 comments on commit f32cf15

Please sign in to comment.