Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Aug 23, 2019
1 parent 11786d0 commit 2e32b88
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module('unit/adapters/json-api-adapter/ajax-options - building requests with fet
);
});

test('ajaxOptions() will not override with existing headers["Content-Type"] POST', function(assert) {
test('ajaxOptions() does not override with existing headers["Content-Type"] POST', function(assert) {
adapter.headers = { 'Content-Type': 'application/x-www-form-urlencoded' };
let url = 'example.com';
let type = 'POST';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,30 @@ module('unit/adapters/rest-adapter/ajax-options - building requests with fetch',
});
});

test('ajaxOptions() can provide own Content-Type', function(assert) {
test('ajaxOptions() can provide own headers["Content-Type"]', function(assert) {
let url = 'example.com';
let type = 'POST';
let ajaxOptions = adapter.ajaxOptions(url, type, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
data: { key: 'value' },
});

assert.deepEqual(ajaxOptions, {
credentials: 'same-origin',
data: { key: 'value' },
body: '{"key":"value"}',
type: 'POST',
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
url: 'example.com',
});
});

test('ajaxOptions() can provide own contentType in options', function(assert) {
let url = 'example.com';
let type = 'POST';
let ajaxOptions = adapter.ajaxOptions(url, type, {
Expand Down

0 comments on commit 2e32b88

Please sign in to comment.