[MM-37064] - Onboarding flow is showing for existing users (#17977)
* [MM-37064] - Onboarding flow is showing for existing users * add tests * fix typo * fix lint * fix tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5d4769318a
Коммит
e252608068
@@ -1537,3 +1537,42 @@ func TestUpdateThreadReadForUser(t *testing.T) {
|
||||
assert.True(t, threadMembership.Following)
|
||||
})
|
||||
}
|
||||
|
||||
func TestCreateUserWithInitialPreferences(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("successfully create a user with initial tutorial and recommended steps preferences", func(t *testing.T) {
|
||||
testUser := th.CreateUser()
|
||||
defer th.App.PermanentDeleteUser(th.Context, testUser)
|
||||
|
||||
preferences, appErr := th.App.GetPreferencesForUser(testUser.Id)
|
||||
require.Nil(t, appErr)
|
||||
|
||||
tutorialStepPref := preferences[1]
|
||||
recommendedNextStepsPref := preferences[0]
|
||||
|
||||
assert.Equal(t, tutorialStepPref.Name, testUser.Id)
|
||||
assert.Equal(t, recommendedNextStepsPref.Category, model.PreferenceRecommendedNextSteps)
|
||||
assert.Equal(t, recommendedNextStepsPref.Name, "hide")
|
||||
assert.Equal(t, recommendedNextStepsPref.Value, "false")
|
||||
})
|
||||
|
||||
t.Run("successfully create a guest user with initial tutorial and recommended steps preferences", func(t *testing.T) {
|
||||
testUser := th.CreateGuest()
|
||||
defer th.App.PermanentDeleteUser(th.Context, testUser)
|
||||
|
||||
preferences, appErr := th.App.GetPreferencesForUser(testUser.Id)
|
||||
require.Nil(t, appErr)
|
||||
|
||||
assert.Equal(t, testUser.Id, preferences[0].UserId)
|
||||
assert.Equal(t, model.PreferenceRecommendedNextSteps, preferences[0].Category)
|
||||
assert.Equal(t, "hide", preferences[0].Name)
|
||||
assert.Equal(t, "false", preferences[0].Value)
|
||||
|
||||
assert.Equal(t, testUser.Id, preferences[1].UserId)
|
||||
assert.Equal(t, model.PreferenceCategoryTutorialSteps, preferences[1].Category)
|
||||
assert.Equal(t, testUser.Id, preferences[1].Name)
|
||||
assert.Equal(t, "0", preferences[1].Value)
|
||||
})
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user