From a9cec9742115a098a031ae7f946eb7bb93648ecd Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 19 Apr 2014 15:17:43 +0100 Subject: Add a couple more test cases for Sync. --- tests/unit_tests/settings_test.coffee | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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") } -- cgit v1.2.3