feat(welcome): 站点外观 - 合并欢迎页开放开关与入口分包修复
# Conflicts: # docs/content/docs/progress/pending-test.mdx
This commit is contained in:
commit
f9dfd48b79
16 files changed
+225
-3
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"infinite-canvas/backend/internal/model"
|
||||
"infinite-canvas/backend/internal/platform"
|
||||
"infinite-canvas/backend/internal/protocol"
|
||||
"infinite-canvas/backend/internal/repository"
|
||||
|
||||
@@ -19,6 +20,9 @@ func TestFeatureAvailabilityDefaultsToDisableFrontendModels(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !setting.WelcomeEnabled {
|
||||
t.Fatal("welcome should be enabled by default")
|
||||
}
|
||||
if setting.Configured || !setting.ShortDramaEnabled || !setting.TaskCenterEnabled || !setting.CreditsEnabled || !setting.CustomChannelsEnabled || setting.FrontendModelsEnabled || !setting.PluginCenterEnabled || !setting.SystemPluginsVisibleToUsers {
|
||||
t.Fatalf("FeatureAvailability() = %#v", setting)
|
||||
}
|
||||
@@ -38,6 +42,28 @@ func TestFeatureAvailabilityLegacySettingKeepsCustomChannelsEnabled(t *testing.T
|
||||
if setting.ShortDramaEnabled || !setting.CustomChannelsEnabled || setting.FrontendModelsEnabled || !setting.PluginCenterEnabled || !setting.SystemPluginsVisibleToUsers {
|
||||
t.Fatalf("FeatureAvailability() = %#v", setting)
|
||||
}
|
||||
if !setting.WelcomeEnabled {
|
||||
t.Fatal("existing settings without welcomeEnabled should keep welcome enabled")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWelcomeAvailabilityCanBeDisabledAndReenabled(t *testing.T) {
|
||||
svc, _ := newFeatureAvailabilityTestService(t)
|
||||
actor := &model.User{ID: "admin-welcome", Role: model.UserRoleAdmin}
|
||||
for _, enabled := range []bool{false, true} {
|
||||
value := platform.DefaultFeatureAvailability()
|
||||
value.WelcomeEnabled = enabled
|
||||
if _, err := svc.UpdateFeatureAvailability(actor, value); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
setting, err := svc.FeatureAvailability()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if setting.WelcomeEnabled != enabled {
|
||||
t.Fatalf("welcomeEnabled = %v, want %v", setting.WelcomeEnabled, enabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateFeatureAvailabilityPersistsAndAudits(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user