mirror of
https://github.com/tenrok/axios.git
synced 2026-06-11 18:02:32 +03:00
Make axios instantiable
This commit is contained in:
+29
-1
@@ -1,6 +1,6 @@
|
||||
var axios = require('../../index');
|
||||
|
||||
describe('api', function () {
|
||||
describe('static api', function () {
|
||||
it('should have request method helpers', function () {
|
||||
expect(typeof axios.get).toEqual('function');
|
||||
expect(typeof axios.head).toEqual('function');
|
||||
@@ -22,8 +22,36 @@ describe('api', function () {
|
||||
expect(typeof axios.defaults.headers).toEqual('object');
|
||||
});
|
||||
|
||||
it('should have interceptors', function () {
|
||||
expect(typeof axios.interceptors.request).toEqual('object');
|
||||
expect(typeof axios.interceptors.response).toEqual('object');
|
||||
});
|
||||
|
||||
it('should have all/spread helpers', function () {
|
||||
expect(typeof axios.all).toEqual('function');
|
||||
expect(typeof axios.spread).toEqual('function');
|
||||
});
|
||||
|
||||
it('should have factory method', function () {
|
||||
expect(typeof axios.createNew).toEqual('function');
|
||||
});
|
||||
});
|
||||
|
||||
describe('instance api', function () {
|
||||
var instance = axios.createNew();
|
||||
|
||||
it('should have request methods', function () {
|
||||
expect(typeof instance.request).toEqual('function');
|
||||
expect(typeof instance.get).toEqual('function');
|
||||
expect(typeof instance.head).toEqual('function');
|
||||
expect(typeof instance.delete).toEqual('function');
|
||||
expect(typeof instance.post).toEqual('function');
|
||||
expect(typeof instance.put).toEqual('function');
|
||||
expect(typeof instance.patch).toEqual('function');
|
||||
});
|
||||
|
||||
it('should have interceptors', function () {
|
||||
expect(typeof instance.interceptors.request).toEqual('object');
|
||||
expect(typeof instance.interceptors.response).toEqual('object');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user