mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 08:14:55 +08:00
feat(bat): 补全工作流校验与调度过滤
新增 parse clear-cache 和 i18n validate,补齐 schedule 的作用域过滤与单轮执行上限,并将列表过滤参数暴露给 bat-api dashboard。同步 RPC、OpenAPI、用户文档和回归测试。 Refs #43
This commit is contained in:
@@ -298,6 +298,44 @@ func TestScheduleUpdateSendsMutationParams(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestScheduleRunSendsScopeAndMaxRuns(t *testing.T) {
|
||||
maxRuns := uint64(2)
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "schedule.run" {
|
||||
t.Fatalf("method = %s", req.Method)
|
||||
}
|
||||
var params ScheduleRunParams
|
||||
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
||||
t.Fatalf("decode params: %v", err)
|
||||
}
|
||||
if params.ID != "nightly-pull" || params.Group != "res" || !params.Force ||
|
||||
params.MaxRuns == nil || *params.MaxRuns != maxRuns {
|
||||
t.Fatalf("params = %#v", params)
|
||||
}
|
||||
return testResponse{
|
||||
Result: testEnvelope{
|
||||
OK: true,
|
||||
Status: "ok",
|
||||
RequestID: "req-test-schedule-run",
|
||||
Data: map[string]any{"command": "schedule-run", "executed": []any{}},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
raw, err := client.ScheduleRun(context.Background(), ScheduleRunParams{
|
||||
ID: "nightly-pull",
|
||||
Group: "res",
|
||||
Force: true,
|
||||
MaxRuns: &maxRuns,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("ScheduleRun error: %v", err)
|
||||
}
|
||||
if !json.Valid(raw) {
|
||||
t.Fatalf("invalid raw JSON: %s", string(raw))
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplicationErrorReturnsAPIError(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "task.status" {
|
||||
|
||||
Reference in New Issue
Block a user