2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-08 17:22:34 +03:00

Make axios instantiable

This commit is contained in:
Nick Uraltsev
2015-10-03 09:38:16 -07:00
parent 4f732e8caa
commit b10874fa67
5 changed files with 194 additions and 42 deletions
+41
View File
@@ -0,0 +1,41 @@
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.createNew();
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.createNew({ timeout: 1000 });
instance.request({
url: '/foo'
});
setTimeout(function () {
request = jasmine.Ajax.requests.mostRecent();
expect(request.timeout).toBe(1000);
done();
}, 0);
});
});