aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/settings_test.coffee13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee
index 5d24c7f2..dd2815f0 100644
--- a/tests/unit_tests/settings_test.coffee
+++ b/tests/unit_tests/settings_test.coffee
@@ -78,3 +78,16 @@ context "settings",
chrome.storage.sync.set { scrollStepSize: JSON.stringify(40) }
chrome.storage.sync.remove 'scrollStepSize'
assert.isFalse Settings.has 'scrollStepSize'
+
+ should "trigger a postUpdateHook", ->
+ message = "Hello World"
+ # Install a bogus update hook for an existing setting.
+ Settings.postUpdateHooks['scrollStepSize'] = (value) -> Sync.message = value
+ chrome.storage.sync.set { scrollStepSize: JSON.stringify(message) }
+ # Was the update hook triggered?
+ assert.equal message, Sync.message
+
+ should "sync a key which is not a setting", ->
+ # There is nothing to test, here. It's purpose is just to ensure that, should additional settings be
+ # added in future, then the Sync won't cause unexpected crashes.
+ chrome.storage.sync.set { notASetting: JSON.stringify("notAUsefullValue") }