From 2e32b88c6f165a1093b382bc69a805dff7f29425 Mon Sep 17 00:00:00 2001 From: snewcomer Date: Sat, 17 Aug 2019 10:56:30 -0700 Subject: [PATCH] update tests --- .../json-api-adapter/ajax-options-test.js | 2 +- .../rest-adapter/ajax-options-test.js | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/-ember-data/tests/unit/adapters/json-api-adapter/ajax-options-test.js b/packages/-ember-data/tests/unit/adapters/json-api-adapter/ajax-options-test.js index d291c26843d..8b010f2ec67 100644 --- a/packages/-ember-data/tests/unit/adapters/json-api-adapter/ajax-options-test.js +++ b/packages/-ember-data/tests/unit/adapters/json-api-adapter/ajax-options-test.js @@ -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'; diff --git a/packages/-ember-data/tests/unit/adapters/rest-adapter/ajax-options-test.js b/packages/-ember-data/tests/unit/adapters/rest-adapter/ajax-options-test.js index ae4aa6a0aaa..86fae73662d 100644 --- a/packages/-ember-data/tests/unit/adapters/rest-adapter/ajax-options-test.js +++ b/packages/-ember-data/tests/unit/adapters/rest-adapter/ajax-options-test.js @@ -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, {