Files
geo/server/internal/tenant/app/schedule_auto_publish_test.go
T
root c7bad83496
Frontend CI / Frontend (push) Successful in 4m17s
Backend CI / Backend (push) Failing after 6m42s
feat(enterprise-site): add WordPress support and scheduled auto-publish to sites
Add WordPress as an enterprise-site CMS type alongside pbootcms, and let
schedule tasks auto-publish generated articles to enterprise sites.

- WordPress connection/publisher service and tests; register wordpress
  media platform and relax cms_type CHECK constraint
- New publish_enterprise_site_targets JSONB column on schedule_tasks with
  array type constraint; thread targets through scheduler dispatch,
  prompt/KOL generation, and worker
- Admin UI: enterprise-site targets in generate/schedule/publish flows,
  KOL package form, MediaView, and i18n strings

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:44:24 +08:00

49 lines
966 B
Go

package app
import (
"testing"
"time"
)
func TestStartScheduleAutoPublishReturnsAfterScheduling(t *testing.T) {
previousRunner := runScheduleAutoPublishBackground
defer func() {
runScheduleAutoPublishBackground = previousRunner
}()
started := make(chan struct{})
release := make(chan struct{})
done := make(chan struct{})
runScheduleAutoPublishBackground = func(fn func()) {
go func() {
close(started)
<-release
fn()
close(done)
}()
}
StartScheduleAutoPublish(ScheduleAutoPublishInput{
InputParams: map[string]interface{}{
"schedule_auto_publish": true,
},
})
select {
case <-started:
case <-time.After(time.Second):
t.Fatalf("background runner was not scheduled")
}
select {
case <-done:
t.Fatalf("auto publish should not block caller until background work completes")
default:
}
close(release)
select {
case <-done:
case <-time.After(time.Second):
t.Fatalf("background auto publish did not finish")
}
}