31 lines
868 B
Go
31 lines
868 B
Go
|
|
package app
|
||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestPublishPlatformRequiresCover(t *testing.T) {
|
||
|
|
t.Parallel()
|
||
|
|
|
||
|
|
for _, platformID := range []string{"weixin_gzh", "baijiahao", "dongchedi"} {
|
||
|
|
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()
|
||
|
|
|
||
|
|
accounts := []platformAccountSeed{{PlatformID: "weixin_gzh"}}
|
||
|
|
if !publishBatchRequiresCover(accounts) {
|
||
|
|
t.Fatal("publishBatchRequiresCover() = false for weixin_gzh, want true")
|
||
|
|
}
|
||
|
|
|
||
|
|
if !schedulePublishPlatformsRequireCover([]string{"weixin_gzh"}) {
|
||
|
|
t.Fatal("schedulePublishPlatformsRequireCover() = false for weixin_gzh, want true")
|
||
|
|
}
|
||
|
|
}
|