2026-05-01 10:21:46 +08:00
|
|
|
package app
|
|
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
|
|
func TestPublishPlatformRequiresCover(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
2026-05-26 18:43:07 +08:00
|
|
|
for _, platformID := range []string{"weixin_gzh", "baijiahao", "dongchedi", "smzdm"} {
|
2026-05-01 10:21:46 +08:00
|
|
|
if !publishPlatformRequiresCover(platformID) {
|
|
|
|
|
t.Fatalf("publishPlatformRequiresCover(%q) = false, want true", platformID)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if publishPlatformRequiresCover("zhihu") {
|
|
|
|
|
t.Fatal("publishPlatformRequiresCover(\"zhihu\") = true, want false")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestPublishCoverRequirementCallersIncludeWeixinGzh(t *testing.T) {
|
|
|
|
|
t.Parallel()
|
|
|
|
|
|
2026-05-26 18:43:07 +08:00
|
|
|
accounts := []platformAccountSeed{{PlatformID: "weixin_gzh"}, {PlatformID: "smzdm"}}
|
2026-05-01 10:21:46 +08:00
|
|
|
if !publishBatchRequiresCover(accounts) {
|
2026-05-26 18:43:07 +08:00
|
|
|
t.Fatal("publishBatchRequiresCover() = false for cover-required platforms, want true")
|
2026-05-01 10:21:46 +08:00
|
|
|
}
|
|
|
|
|
|
2026-05-26 18:43:07 +08:00
|
|
|
if !schedulePublishPlatformsRequireCover([]string{"weixin_gzh", "smzdm"}) {
|
|
|
|
|
t.Fatal("schedulePublishPlatformsRequireCover() = false for cover-required platforms, want true")
|
2026-05-01 10:21:46 +08:00
|
|
|
}
|
|
|
|
|
}
|