diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-10-06 06:57:51 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-10-06 06:57:51 +0200 |
commit | 0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25 (patch) | |
tree | c321601f04cbfd02fb6e12878e745dc49a612c86 /services/sync/tests/unit/test_engine.js | |
parent | 8860eddcee1417483cafd114f3a9ec127e0f1f74 (diff) | |
download | UXP-0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25.tar UXP-0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25.tar.gz UXP-0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25.tar.lz UXP-0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25.tar.xz UXP-0c47c83e1b3b7d95681a43fbb0de0e17b2cd5b25.zip |
Import Tycho weave client
Diffstat (limited to 'services/sync/tests/unit/test_engine.js')
-rw-r--r-- | services/sync/tests/unit/test_engine.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/services/sync/tests/unit/test_engine.js b/services/sync/tests/unit/test_engine.js index be637efc8..000cd5b4a 100644 --- a/services/sync/tests/unit/test_engine.js +++ b/services/sync/tests/unit/test_engine.js @@ -25,8 +25,8 @@ SteamTracker.prototype = { __proto__: Tracker.prototype }; -function SteamEngine(name, service) { - Engine.call(this, name, service); +function SteamEngine(service) { + Engine.call(this, "Steam", service); this.wasReset = false; this.wasSynced = false; } @@ -44,7 +44,7 @@ SteamEngine.prototype = { } }; -var engineObserver = { +let engineObserver = { topics: [], observe: function(subject, topic, data) { @@ -69,7 +69,7 @@ function run_test() { add_test(function test_members() { _("Engine object members"); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); do_check_eq(engine.Name, "Steam"); do_check_eq(engine.prefName, "steam"); do_check_true(engine._store instanceof SteamStore); @@ -79,7 +79,7 @@ add_test(function test_members() { add_test(function test_score() { _("Engine.score corresponds to tracker.score and is readonly"); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); do_check_eq(engine.score, 0); engine._tracker.score += 5; do_check_eq(engine.score, 5); @@ -97,7 +97,7 @@ add_test(function test_score() { add_test(function test_resetClient() { _("Engine.resetClient calls _resetClient"); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); do_check_false(engine.wasReset); engine.resetClient(); @@ -112,7 +112,7 @@ add_test(function test_resetClient() { add_test(function test_invalidChangedIDs() { _("Test that invalid changed IDs on disk don't end up live."); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); let tracker = engine._tracker; tracker.changedIDs = 5; tracker.saveChangedIDs(function onSaved() { @@ -127,7 +127,7 @@ add_test(function test_invalidChangedIDs() { add_test(function test_wipeClient() { _("Engine.wipeClient calls resetClient, wipes store, clears changed IDs"); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); do_check_false(engine.wasReset); do_check_false(engine._store.wasWiped); do_check_true(engine._tracker.addChangedID("a-changed-id")); @@ -150,7 +150,7 @@ add_test(function test_wipeClient() { add_test(function test_enabled() { _("Engine.enabled corresponds to preference"); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); try { do_check_false(engine.enabled); Svc.Prefs.set("engine.steam", true); @@ -165,18 +165,16 @@ add_test(function test_enabled() { }); add_test(function test_sync() { - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); try { _("Engine.sync doesn't call _sync if it's not enabled"); do_check_false(engine.enabled); do_check_false(engine.wasSynced); engine.sync(); - do_check_false(engine.wasSynced); _("Engine.sync calls _sync if it's enabled"); engine.enabled = true; - engine.sync(); do_check_true(engine.wasSynced); do_check_eq(engineObserver.topics[0], "weave:engine:sync:start"); @@ -191,7 +189,7 @@ add_test(function test_sync() { add_test(function test_disabled_no_track() { _("When an engine is disabled, its tracker is not tracking."); - let engine = new SteamEngine("Steam", Service); + let engine = new SteamEngine(Service); let tracker = engine._tracker; do_check_eq(engine, tracker.engine); |