From fe51f53303f03643bf68d75f014cf0ea82b52a24 Mon Sep 17 00:00:00 2001 From: dbs Date: Mon, 25 Apr 2011 04:12:41 +0000 Subject: [PATCH] Sidestep JSON object ordering in unit tests Depending on the JS engine and version of Dojo, the order of attributes in JSON objects may change (as is explicitly allowed by the JSON spec). To avoid false test failures, only use one attribute in the object. git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@2232 9efc2488-bf62-4759-914b-345cdb29e865 --- src/javascript/tests/testJSON_v1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/javascript/tests/testJSON_v1.js b/src/javascript/tests/testJSON_v1.js index 19aee2c..9530fa0 100644 --- a/src/javascript/tests/testJSON_v1.js +++ b/src/javascript/tests/testJSON_v1.js @@ -43,7 +43,7 @@ doh.register("JSONTests", [ }, function test_js2JSON_objects_ordered() { // Order of object attributes is not guaranteed - doh.assertTrue(js2JSON({"foo":{"one":null,"two":2}}) == '{"foo":{"one":null,"two":2}}'); + doh.assertTrue(js2JSON({"foo":{"one":[null,"two",2]}}) == '{"foo":{"one":[null,"two",2]}}'); }, function test_js2JSONRaw_strict() { // Solo nulls and booleans are stringified XXX @@ -72,7 +72,7 @@ doh.register("JSONTests", [ }, function test_js2JSONRaw_objects_ordered() { // Order of object attributes is not guaranteed - doh.assertTrue(js2JSONRaw({"foo":{"one":null,"two":2}}) == '{"foo":{"one":null,"two":2}}'); + doh.assertTrue(js2JSONRaw({"foo":{"one":[null,"two",2]}}) == '{"foo":{"one":[null,"two",2]}}'); }, function test_JSON2jsRaw_strict() { // Standalone quoted nulls and booleans are converted to primitives -- 2.43.2