mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
42 lines
807 B
JavaScript
42 lines
807 B
JavaScript
var axios = require('../../index');
|
|
|
|
describe('instance', function () {
|
|
beforeEach(function () {
|
|
jasmine.Ajax.install();
|
|
});
|
|
|
|
afterEach(function () {
|
|
jasmine.Ajax.uninstall();
|
|
});
|
|
|
|
it('should make an http request', function (done) {
|
|
var instance = axios.create();
|
|
|
|
instance.request({
|
|
url: '/foo'
|
|
});
|
|
|
|
setTimeout(function () {
|
|
request = jasmine.Ajax.requests.mostRecent();
|
|
|
|
expect(request.url).toBe('/foo');
|
|
done();
|
|
}, 0);
|
|
});
|
|
|
|
it('should use instance options', function (done) {
|
|
var instance = axios.create({ timeout: 1000 });
|
|
|
|
instance.request({
|
|
url: '/foo'
|
|
});
|
|
|
|
setTimeout(function () {
|
|
request = jasmine.Ajax.requests.mostRecent();
|
|
|
|
expect(request.timeout).toBe(1000);
|
|
done();
|
|
}, 0);
|
|
});
|
|
});
|