fix mobile task rules and feature availability

This commit is contained in:
richjohnrambo
2026-10-18 20:53:33 +08:00
parent b79b781f15
commit 5a0fe67027
11 changed files with 144 additions and 130 deletions
+12
View File
@@ -77,6 +77,18 @@ func TestParseFeaturesSupportsNestedAndLegacyKeys(t *testing.T) {
}
}
func TestParseFeaturesDefaultsMissingSwitchesToEnabled(t *testing.T) {
features := parseFeatures(json.RawMessage(`{}`))
if !features.TaskEnabled || !features.RechargeEnabled || !features.WithdrawalEnabled || !features.ManualMallEnabled {
t.Fatalf("missing switches should default to enabled: %+v", features)
}
features = parseFeatures(json.RawMessage(`{"features":{"task_enabled":false,"withdrawal_enabled":false}}`))
if features.TaskEnabled || features.WithdrawalEnabled || !features.RechargeEnabled || !features.ManualMallEnabled {
t.Fatalf("explicitly disabled switches must remain disabled: %+v", features)
}
}
func TestBannersSanitizeTargets(t *testing.T) {
service := New(fakeRepository{banners: []store.Banner{
{ID: 1, TargetType: 2, TargetValue: "/receive"},