Bug 1433234 - Replace do_check_array_eq by Assert.deepEqual. r?eoger draft
authorvinicius <viniciuscosta0197@gmail.com>
Sat, 27 Jan 2018 19:29:55 -0200
changeset 748055 4ad9d3376964
parent 748015 232dbd5acc3f
push id97059
push userbmo:viniciuscosta0197@gmail.com
push dateSat, 27 Jan 2018 21:32:30 +0000
reviewerseoger
bugs1433234
milestone60.0a1
Bug 1433234 - Replace do_check_array_eq by Assert.deepEqual. r?eoger MozReview-Commit-ID: 7goh46IkVrW ***
services/sync/tests/unit/head_helpers.js
services/sync/tests/unit/test_enginemanager.js
services/sync/tests/unit/test_keys.js
--- a/services/sync/tests/unit/head_helpers.js
+++ b/services/sync/tests/unit/head_helpers.js
@@ -263,24 +263,16 @@ function mockGetWindowEnumerator(url, nu
       return elements.length;
     },
     getNext() {
       return elements.shift();
     },
   };
 }
 
-// Helper that allows checking array equality.
-function do_check_array_eq(a1, a2) {
-  Assert.equal(a1.length, a2.length);
-  for (let i = 0; i < a1.length; ++i) {
-    Assert.equal(a1[i], a2[i]);
-  }
-}
-
 // Helper function to get the sync telemetry and add the typically used test
 // engine names to its list of allowed engines.
 function get_sync_test_telemetry() {
   let ns = {};
   Cu.import("resource://services-sync/telemetry.js", ns);
   let testEngines = ["rotary", "steam", "sterling", "catapult"];
   for (let engineName of testEngines) {
     ns.SyncTelemetry.allowedEngines.add(engineName);
--- a/services/sync/tests/unit/test_enginemanager.js
+++ b/services/sync/tests/unit/test_enginemanager.js
@@ -76,25 +76,25 @@ add_task(async function test_basics() {
 
   _("getEnabled() returns enabled engines in sorted order");
   petrol.syncPriority = 1;
   dummy.syncPriority = 2;
   diesel.syncPriority = 3;
 
   engines = await manager.getEnabled();
 
-  do_check_array_eq(engines, [petrol, dummy, diesel]);
+  Assert.deepEqual(engines, [petrol, dummy, diesel]);
 
   _("Changing the priorities should change the order in getEnabled()");
 
   dummy.syncPriority = 4;
 
   engines = await manager.getEnabled();
 
-  do_check_array_eq(engines, [petrol, diesel, dummy]);
+  Assert.deepEqual(engines, [petrol, diesel, dummy]);
 
   _("Unregister an engine by name");
   manager.unregister("dummy");
   Assert.equal((await manager.get("dummy")), undefined);
   engines = await manager.getAll();
   Assert.equal(engines.length, 2);
   Assert.equal(engines.indexOf(dummy), -1);
 
--- a/services/sync/tests/unit/test_keys.js
+++ b/services/sync/tests/unit/test_keys.js
@@ -256,15 +256,15 @@ add_task(async function test_ensureLogge
   Assert.ok(!d2.same);
   Assert.ok(!d3.same);
   Assert.ok(!d4.same);
   Assert.ok(!d5.same);
   Assert.ok(!d6.same);
   Assert.ok(d7.same);
   Assert.ok(d8.same);
 
-  do_check_array_eq(d1.changed, []);
-  do_check_array_eq(d2.changed, ["bar"]);
-  do_check_array_eq(d3.changed, ["bar"]);
-  do_check_array_eq(d4.changed, ["bar", "foo"]);
-  do_check_array_eq(d5.changed, ["baz", "foo"]);
-  do_check_array_eq(d6.changed, ["bar", "foo"]);
+  Assert.deepEqual(d1.changed, []);
+  Assert.deepEqual(d2.changed, ["bar"]);
+  Assert.deepEqual(d3.changed, ["bar"]);
+  Assert.deepEqual(d4.changed, ["bar", "foo"]);
+  Assert.deepEqual(d5.changed, ["baz", "foo"]);
+  Assert.deepEqual(d6.changed, ["bar", "foo"]);
 });