[Opensrf-commits] r2233 - branches/rel_2_0/src/javascript/tests (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 25 00:14:14 EDT 2011


Author: dbs
Date: 2011-04-25 00:14:11 -0400 (Mon, 25 Apr 2011)
New Revision: 2233

Modified:
   branches/rel_2_0/src/javascript/tests/testJSON_v1.js
Log:
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.


Modified: branches/rel_2_0/src/javascript/tests/testJSON_v1.js
===================================================================
--- branches/rel_2_0/src/javascript/tests/testJSON_v1.js	2011-04-25 04:12:41 UTC (rev 2232)
+++ branches/rel_2_0/src/javascript/tests/testJSON_v1.js	2011-04-25 04:14:11 UTC (rev 2233)
@@ -43,7 +43,7 @@
     },
     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 @@
     },
     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



More information about the opensrf-commits mailing list