aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit_tests')
-rw-r--r--tests/unit_tests/exclusion_test.coffee1
-rw-r--r--tests/unit_tests/settings_test.coffee12
-rw-r--r--tests/unit_tests/test_chrome_stubs.coffee4
-rw-r--r--tests/unit_tests/utils_test.coffee1
4 files changed, 11 insertions, 7 deletions
diff --git a/tests/unit_tests/exclusion_test.coffee b/tests/unit_tests/exclusion_test.coffee
index 28c17a2f..0e4b87bc 100644
--- a/tests/unit_tests/exclusion_test.coffee
+++ b/tests/unit_tests/exclusion_test.coffee
@@ -15,7 +15,6 @@ root.Marks =
extend(global, require "../../lib/utils.js")
Utils.getCurrentVersion = -> '1.44'
extend(global,require "../../lib/settings.js")
-Settings.init()
extend(global, require "../../background_scripts/exclusions.js")
extend(global, require "../../background_scripts/commands.js")
extend(global, require "../../background_scripts/main.js")
diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee
index ded7b5f8..08145190 100644
--- a/tests/unit_tests/settings_test.coffee
+++ b/tests/unit_tests/settings_test.coffee
@@ -14,7 +14,6 @@ context "settings",
stub global, 'localStorage', {}
Settings.cache = global.localStorage # Point the settings cache to the new localStorage object.
Settings.postUpdateHooks = {} # Avoid running update hooks which include calls to outside of settings.
- Settings.init()
should "save settings in localStorage as JSONified strings", ->
Settings.set 'dummy', ""
@@ -39,16 +38,23 @@ context "settings",
Settings.clear 'scrollStepSize'
assert.equal Settings.get('scrollStepSize'), 60
+context "synced settings",
+
+ setup ->
+ stub global, 'localStorage', {}
+ Settings.cache = global.localStorage # Point the settings cache to the new localStorage object.
+ Settings.postUpdateHooks = {} # Avoid running update hooks which include calls to outside of settings.
+
should "propagate non-default value via synced storage listener", ->
Settings.set 'scrollStepSize', 20
assert.equal Settings.get('scrollStepSize'), 20
- Settings.Sync.handleStorageUpdate { scrollStepSize: { newValue: "40" } }
+ Settings.propagateChangesFromChromeStorage { scrollStepSize: { newValue: "40" } }
assert.equal Settings.get('scrollStepSize'), 40
should "propagate default value via synced storage listener", ->
Settings.set 'scrollStepSize', 20
assert.equal Settings.get('scrollStepSize'), 20
- Settings.Sync.handleStorageUpdate { scrollStepSize: { newValue: "60" } }
+ Settings.propagateChangesFromChromeStorage { scrollStepSize: { newValue: "60" } }
assert.isFalse Settings.has 'scrollStepSize'
should "propagate non-default values from synced storage", ->
diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee
index 16f0e144..fe2fc298 100644
--- a/tests/unit_tests/test_chrome_stubs.coffee
+++ b/tests/unit_tests/test_chrome_stubs.coffee
@@ -70,14 +70,14 @@ exports.chrome =
chrome.runtime.lastError = undefined
key_value = {}
key_value[key] = { newValue: value }
- @func(key_value,'synced storage stub') if @func
+ @func(key_value,'sync') if @func
callEmpty: (key) ->
chrome.runtime.lastError = undefined
if @func
items = {}
items[key] = {}
- @func(items,'synced storage stub')
+ @func(items,'sync')
session:
MAX_SESSION_RESULTS: 25
diff --git a/tests/unit_tests/utils_test.coffee b/tests/unit_tests/utils_test.coffee
index f9ed3636..67c3b333 100644
--- a/tests/unit_tests/utils_test.coffee
+++ b/tests/unit_tests/utils_test.coffee
@@ -3,7 +3,6 @@ extend global, require "./test_chrome_stubs.js"
extend(global, require "../../lib/utils.js")
Utils.getCurrentVersion = -> '1.43'
extend(global, require "../../lib/settings.js")
-Settings.init()
context "isUrl",
should "accept valid URLs", ->