Files
xiaohongshu-mcp/xiaohongshu/publish_test.go
zy 0e4450b12c refactor: 改进浏览器实例管理,按需创建浏览器实例 (#12)
- 移除全局浏览器单例,改为按需创建浏览器实例
- 添加 configs/browser.go 用于管理无头模式配置
- 更新 service.go 中所有方法,每次调用时创建新的浏览器实例
- 更新测试文件,使用新的浏览器管理方式
- 确保每个浏览器实例使用后正确关闭,避免资源泄漏

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-08-17 15:30:16 +08:00

33 lines
600 B
Go

package xiaohongshu
import (
"context"
"testing"
"github.com/xpzouying/xiaohongshu-mcp/browser"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestPublish(t *testing.T) {
t.Skip("SKIP: 测试发布")
b := browser.NewBrowser(false)
defer b.Close()
page := b.NewPage()
defer page.Close()
action, err := NewPublishImageAction(page)
require.NoError(t, err)
err = action.Publish(context.Background(), PublishImageContent{
Title: "Hello World",
Content: "Hello World",
ImagePaths: []string{"/tmp/1.jpg"},
})
assert.NoError(t, err)
}