summaryrefslogtreecommitdiffstats
path: root/store/sql_preference_store_test.go
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-07-14 10:08:36 -0400
committerChristopher Speller <crspeller@gmail.com>2016-07-14 10:08:36 -0400
commitcaabfbcdd56bdced7c5c1d38e00f488adffe7c60 (patch)
tree4d52326767246f331da352f0427e34bf714e3130 /store/sql_preference_store_test.go
parent8e810bc2ebb743717b5b0fc4541fcd3b2565966c (diff)
downloadchat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.tar.gz
chat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.tar.bz2
chat-caabfbcdd56bdced7c5c1d38e00f488adffe7c60.zip
PLT-2992 Added the ability to use different themes for each team (#3411)
* Cleaned up user_settings_theme.jsx and import_theme_modal.jsx * Made ImportThemeModal use a callback to return the theme to the user settings modal instead of saving it directly * Moved user theme from model to preferences * Added serverside API to delete preferences TODO update package with client stuff * Changed constants.jsx so that Preferences and ActionTypes can be imported on their own * Updated ThemeProps migration code to properly rename solarized code themes * Fixed warnings thrown by AppDispatcher * Added clientside UI to support team-specific themes * Removed debugging code from test * Fixed setting a user's theme when they haven't set their theme before
Diffstat (limited to 'store/sql_preference_store_test.go')
-rw-r--r--store/sql_preference_store_test.go27
1 files changed, 26 insertions, 1 deletions
diff --git a/store/sql_preference_store_test.go b/store/sql_preference_store_test.go
index ec9d1df6c..8c6a2b6af 100644
--- a/store/sql_preference_store_test.go
+++ b/store/sql_preference_store_test.go
@@ -193,7 +193,7 @@ func TestPreferenceGetAll(t *testing.T) {
}
}
-func TestPreferenceDelete(t *testing.T) {
+func TestPreferenceDeleteByUser(t *testing.T) {
Setup()
userId := model.NewId()
@@ -367,3 +367,28 @@ func TestDeleteUnusedFeatures(t *testing.T) {
t.Fatalf("Found %d features with value 'true', expected to find at least %d features", val, 2)
}
}
+
+func TestPreferenceDelete(t *testing.T) {
+ Setup()
+
+ preference := model.Preference{
+ UserId: model.NewId(),
+ Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,
+ Name: model.NewId(),
+ Value: "value1a",
+ }
+
+ Must(store.Preference().Save(&model.Preferences{preference}))
+
+ if prefs := Must(store.Preference().GetAll(preference.UserId)).(model.Preferences); len([]model.Preference(prefs)) != 1 {
+ t.Fatal("should've returned 1 preference")
+ }
+
+ if result := <-store.Preference().Delete(preference.UserId, preference.Category, preference.Name); result.Err != nil {
+ t.Fatal(result.Err)
+ }
+
+ if prefs := Must(store.Preference().GetAll(preference.UserId)).(model.Preferences); len([]model.Preference(prefs)) != 0 {
+ t.Fatal("should've returned no preferences")
+ }
+}