Files
ttstd-infinite-canvas/backend/internal/service/price_validation_test.go
QAyong 5b7f173102 feat: 完善创作工作台与用户诊断支持 (#295)
* feat(canvas): 参考素材 - 增加移除按钮并删除对应连线

* feat(canvas): 完善节点面板交互与拖拽反馈

* fix(canvas): 画布交互与小地图 - 统一浮层层级并完善节点识别

* feat(prompt-optimizer): 增加 AI 提示词优化器及宿主接入

* feat(canvas): 画布 - 增加自动整理节点按钮并补充文档

* chore(web): 前端 - 修正提示词优化器格式

* chore(backend): 后端 - 修正 Go 格式检查

* feat(workspace): 完善诊断导出与本地排障支持

* chore(web): 格式化诊断导出文件

* fix(web-test): 兼容 Bun 测试运行时

* fix(web-test): 对齐模型目录协议断言
2026-08-25 13:49:15 +08:00

33 lines
1.3 KiB
Go

package service
import (
"testing"
"infinite-canvas/backend/internal/model"
)
func TestValidateChannelModelPriceSupportsArkVideoTokensOnly(t *testing.T) {
const outputPrice = int64(16_000_000)
if !ValidateChannelModelPrice("token", "video", model.ChannelInterfaceVolcengineArkVideo, 0, 0, outputPrice, 0) {
t.Fatal("Volcengine Ark video Token price should be valid")
}
for _, protocol := range []model.ChannelInterfaceType{model.ChannelInterfaceVolcengineJiMengVideo, model.ChannelInterfaceNewAPIVideo} {
if ValidateChannelModelPrice("token", "video", protocol, 0, 0, outputPrice, 0) {
t.Fatalf("video protocol %q should not support Token pricing", protocol)
}
}
}
func TestHasValidPriceUsesChannelProtocolForTokenTiers(t *testing.T) {
tier := model.ChannelModelPriceTier{Enabled: true, PriceConfigured: true, BillingMode: "token", OutputTokenPriceMicrocredits: 16_000_000}
ark := &model.ChannelModel{Capability: "video", Protocol: model.ChannelInterfaceVolcengineArkVideo, PriceTiers: []model.ChannelModelPriceTier{tier}}
if !HasValidPrice(ark) {
t.Fatal("Volcengine Ark video Token tier should be valid")
}
jimeng := &model.ChannelModel{Capability: "video", Protocol: model.ChannelInterfaceVolcengineJiMengVideo, PriceTiers: []model.ChannelModelPriceTier{tier}}
if HasValidPrice(jimeng) {
t.Fatal("JiMeng video Token tier should be invalid")
}
}