mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-23 18:34:02 +02:00
Added duplicate data test for user preference (#3968)
* Added handling of duplicate key conflicts * Added a test * Add value checks and fix username for the test Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
This commit is contained in:
parent
a40f978bc2
commit
f5a068e382
@ -1,4 +1,9 @@
|
||||
INSERT INTO focalboard_users
|
||||
(id, username, props)
|
||||
VALUES
|
||||
('user-id', 'johndoe', '{"focalboard_welcomePageViewed": true, "hiddenBoardIDs": ["board1", "board2"], "focalboard_tourCategory": "onboarding", "focalboard_onboardingTourStep": 1, "focalboard_onboardingTourStarted": true, "focalboard_version72MessageCanceled": true, "focalboard_lastWelcomeVersion": 7}');
|
||||
('user-id', 'johndoe', '{"focalboard_welcomePageViewed": true, "hiddenBoardIDs": ["board1", "board2"], "focalboard_tourCategory": "onboarding", "focalboard_onboardingTourStep": 1, "focalboard_onboardingTourStarted": false, "focalboard_version72MessageCanceled": true, "focalboard_lastWelcomeVersion": 7}');
|
||||
|
||||
INSERT INTO focalboard_preferences
|
||||
(UserId, Category, Name, Value)
|
||||
VALUES
|
||||
('user-id', 'focalboard', 'onboardingTourStarted', true);
|
||||
|
@ -40,7 +40,11 @@ func Test27MigrateUserPropsToPreferences(t *testing.T) {
|
||||
require.Contains(t, userProps, "focalboard_onboardingTourStep")
|
||||
require.Equal(t, float64(1), userProps["focalboard_onboardingTourStep"])
|
||||
require.Contains(t, userProps, "focalboard_onboardingTourStarted")
|
||||
require.True(t, userProps["focalboard_onboardingTourStarted"].(bool))
|
||||
// initially, onboardingTourStarted will be false on the user,
|
||||
// but already inserted in the preferences table as true. The
|
||||
// migration should not overwrite the already existing value,
|
||||
// so after migration #27, this value should be true
|
||||
require.False(t, userProps["focalboard_onboardingTourStarted"].(bool))
|
||||
require.Contains(t, userProps, "focalboard_version72MessageCanceled")
|
||||
require.True(t, userProps["focalboard_version72MessageCanceled"].(bool))
|
||||
require.Contains(t, userProps, "focalboard_lastWelcomeVersion")
|
||||
|
Loading…
x
Reference in New Issue
Block a user