2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

Cleaning up tests a bit

This commit is contained in:
Matt Zabriskie
2016-03-04 10:35:05 -07:00
parent c181d8ade9
commit 371b82a2a0
11 changed files with 106 additions and 251 deletions
+7 -24
View File
@@ -32,9 +32,7 @@ describe('headers', function () {
it('should default common headers', function (done) {
var headers = axios.defaults.headers.common;
axios({
url: '/foo'
});
axios('/foo');
setTimeout(function () {
var request = jasmine.Ajax.requests.mostRecent();
@@ -51,11 +49,7 @@ describe('headers', function () {
it('should add extra headers for post', function (done) {
var headers = axios.defaults.headers.common;
axios({
method: 'post',
url: '/foo',
data: 'fizz=buzz'
});
axios.post('/foo', 'fizz=buzz');
setTimeout(function () {
var request = jasmine.Ajax.requests.mostRecent();
@@ -70,13 +64,9 @@ describe('headers', function () {
});
it('should use application/json when posting an object', function (done) {
axios({
url: '/foo/bar',
method: 'post',
data: {
firstName: 'foo',
lastName: 'bar'
}
axios.post('/foo/bar', {
firstName: 'foo',
lastName: 'bar'
});
setTimeout(function () {
@@ -87,10 +77,7 @@ describe('headers', function () {
});
it('should remove content-type if data is empty', function (done) {
axios({
url: '/foo',
method: 'post'
});
axios.post('/foo');
setTimeout(function () {
var request = jasmine.Ajax.requests.mostRecent();
@@ -100,11 +87,7 @@ describe('headers', function () {
});
it('should preserve content-type if data is false', function (done) {
axios({
url: '/foo',
method: 'post',
data: false
});
axios.post('/foo', false);
setTimeout(function () {
var request = jasmine.Ajax.requests.mostRecent();