Repository: olingo-odata4-js Updated Branches: refs/heads/master 2bff67778 -> 191d1c288
[OLINGO-238] adopt tests/odata-handler-tests.js Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/repo Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/commit/191d1c28 Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/tree/191d1c28 Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/diff/191d1c28 Branch: refs/heads/master Commit: 191d1c288fa1aba07b8a0bf300e6942bbab85284 Parents: 2bff677 Author: Sven Kobler <[email protected]> Authored: Fri May 16 15:34:48 2014 +0200 Committer: Sven Kobler <[email protected]> Committed: Fri May 16 15:34:48 2014 +0200 ---------------------------------------------------------------------- datajs/Gruntfile.js | 4 ++-- datajs/tests/odata-handler-tests.js | 34 ++++++++++++++++---------------- datajs/tests/odata-qunit-tests.htm | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/191d1c28/datajs/Gruntfile.js ---------------------------------------------------------------------- diff --git a/datajs/Gruntfile.js b/datajs/Gruntfile.js index 9053bc7..dc082d1 100644 --- a/datajs/Gruntfile.js +++ b/datajs/Gruntfile.js @@ -58,14 +58,14 @@ module.exports = function(grunt) { https: true, port: 44355, rejectUnauthorized: false, - }/*,{ + },{ context: "/tests/endpoints/", // When the url contains this... host: "localhost", changeOrigin: true, https: false, port: 46541, rejectUnauthorized: false, - },{ + }/*,{ context: "/tests/common/", // When the url contains this... host: "localhost", changeOrigin: true, http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/191d1c28/datajs/tests/odata-handler-tests.js ---------------------------------------------------------------------- diff --git a/datajs/tests/odata-handler-tests.js b/datajs/tests/odata-handler-tests.js index 7ec8a07..b38e9d8 100644 --- a/datajs/tests/odata-handler-tests.js +++ b/datajs/tests/odata-handler-tests.js @@ -129,27 +129,27 @@ { response: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: "response 0" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "4.0" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "4.0" } }, { response: { headers: { "Content-Type": "application/json" }, body: "response 1" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "" } }, { response: { headers: { "Content-Type": "otherMediaType" }, body: "response 2" }, shouldHit: false, - context: { contentType: OData.contentType("otherMediaType"), dataServiceVersion: "" } + context: { contentType: OData.handler.contentType("otherMediaType"), dataServiceVersion: "" } }, { response: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, body: "response 3" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "4.0" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "4.0" } }, { response: { body: "response 4" }, shouldHit: false, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "" } }, { response: null, @@ -173,7 +173,7 @@ return body; }; - var testHandler = OData.handler(testRead, null, "application/json", "4.0"); + var testHandler = OData.handler.handler(testRead, null, "application/json", "4.0"); var len, expectedAssertCount = 0; for (i = 0, len = tests.length; i < len; i++) { @@ -196,17 +196,17 @@ { request: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, data: "request 0" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "4.0" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "4.0" } }, { request: { headers: { "Content-Type": "application/json" }, data: "request 1" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: undefined } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: undefined } }, { request: { headers: { "Content-Type": "otherMediaType" }, data: "request 2" }, shouldHit: false, - context: { contentType: OData.contentType("otherMediaType"), dataServiceVersion: undefined } + context: { contentType: OData.handler.contentType("otherMediaType"), dataServiceVersion: undefined } }, { request: { headers: {}, data: "request 3" }, @@ -216,7 +216,7 @@ { request: { headers: { "Content-Type": "application/json", "OData-Version": "4.0" }, data: "request 4" }, shouldHit: true, - context: { contentType: OData.contentType("application/json"), dataServiceVersion: "4.0" } + context: { contentType: OData.handler.contentType("application/json"), dataServiceVersion: "4.0" } }, { request: null, @@ -239,7 +239,7 @@ return data; }; - var testHandler = OData.handler(null, testWrite, "application/json", "4.0"); + var testHandler = OData.handler.handler(null, testWrite, "application/json", "4.0"); var i, len, expectedAssertCount = 0; for (i = 0, len = tests.length; i < len; i++) { @@ -258,11 +258,11 @@ djstest.addTest(function handlerWriteUpdatesRequestContentTypeTest() { var testWrite = function (handler, data, context) { - context.contentType = OData.contentType("my new content type"); + context.contentType = OData.handler.contentType("my new content type"); return data; }; - var testHandler = OData.handler(null, testWrite, "application/json", "4.0"); + var testHandler = OData.handler.handler(null, testWrite, "application/json", "4.0"); var tests = [ { request: { headers: { "Content-Type": "application/json" }, data: "request 0" }, expected: "application/json" }, @@ -289,13 +289,13 @@ var i, len, cTypeString; for (i = 0, len = tests.length; i < len; i++) { - var actual = OData.contentType(tests[i].contentType); + var actual = OData.handler.contentType(tests[i].contentType); djstest.assertAreEqual(actual.mediaType, tests[i].expected.mediaType, "Content type media type is parsed correctly"); djstest.assertAreEqualDeep(actual.properties, tests[i].expected.properties, "Content type properties are parsed correctly"); } - djstest.assert(!OData.contentType(undefined), "contentType returns undefined for undefined input"); - djstest.assert(!OData.contentType(null), "contentType returns undefined for null input"); + djstest.assert(!OData.handler.contentType(undefined), "contentType returns undefined for undefined input"); + djstest.assert(!OData.handler.contentType(null), "contentType returns undefined for null input"); djstest.done(); }); @@ -309,7 +309,7 @@ var i, len, cTypeString; for (i = 0, len = tests.length; i < len; i++) { - cTypeString = OData.contentTypeToString(tests[i].contentType); + cTypeString = OData.handler.contentTypeToString(tests[i].contentType); djstest.assertAreEqual(cTypeString, tests[i].expected, "contentTypeToString returns the correct contentType string"); } http://git-wip-us.apache.org/repos/asf/olingo-odata4-js/blob/191d1c28/datajs/tests/odata-qunit-tests.htm ---------------------------------------------------------------------- diff --git a/datajs/tests/odata-qunit-tests.htm b/datajs/tests/odata-qunit-tests.htm index 12c06c5..fdcd4da 100644 --- a/datajs/tests/odata-qunit-tests.htm +++ b/datajs/tests/odata-qunit-tests.htm @@ -80,7 +80,7 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEAL <!-- <script type="text/javascript" src="odata-json-light-tests.js"></script>--> <script type="text/javascript" src="odata-metadata-tests.js"></script> <script type="text/javascript" src="odata-xml-tests.js"></script> -<!--SK TODO enable <script type="text/javascript" src="odata-handler-tests.js"></script>--> + <script type="text/javascript" src="odata-handler-tests.js"></script> <!--SK TODO enable <script type="text/javascript" src="odata-net-tests.js"></script>--> <!--SK TODO enable <script type="text/javascript" src="odata-batch-tests.js"></script>-->
