mirror of
https://github.com/Yuyi-Oak/BlueArchiveToolkit.git
synced 2026-09-18 10:04:55 +08:00
feat(patch):统一清单驱动汉化发布
This commit is contained in:
@@ -637,10 +637,12 @@ type GlossaryDiagnoseReport struct {
|
||||
}
|
||||
|
||||
// LocalizedPublishParams selects the source of one localized release
|
||||
// publication. TranslationFile and FromWorker are mutually exclusive.
|
||||
// publication. Exactly one of TranslationFile, FromWorker, or PatchManifest
|
||||
// must be set.
|
||||
type LocalizedPublishParams struct {
|
||||
TranslationFile string `json:"translation_file,omitempty"`
|
||||
FromWorker bool `json:"from_worker,omitempty"`
|
||||
PatchManifest string `json:"patch_manifest,omitempty"`
|
||||
LocalizedReleaseID string `json:"localized_release_id,omitempty"`
|
||||
Force bool `json:"force,omitempty"`
|
||||
}
|
||||
|
||||
@@ -797,6 +797,38 @@ func TestLocalizedPublishSendsWorkerSourceAndReleaseOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalizedPublishSendsPatchManifestSource(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
var params LocalizedPublishParams
|
||||
if err := json.Unmarshal(req.Params, ¶ms); err != nil {
|
||||
t.Fatalf("decode params: %v", err)
|
||||
}
|
||||
if params.PatchManifest != "/tmp/patch-manifest.json" ||
|
||||
params.TranslationFile != "" || params.FromWorker {
|
||||
t.Fatalf("params = %#v", params)
|
||||
}
|
||||
return testResponse{
|
||||
Result: testEnvelope{
|
||||
OK: true,
|
||||
Status: "ok",
|
||||
RequestID: "req-test-localized-patch-manifest",
|
||||
Data: map[string]any{"status": "published"},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
raw, err := client.LocalizedPublish(context.Background(), LocalizedPublishParams{
|
||||
PatchManifest: "/tmp/patch-manifest.json",
|
||||
LocalizedReleaseID: "localized-v1",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("LocalizedPublish error: %v", err)
|
||||
}
|
||||
if !json.Valid(raw) {
|
||||
t.Fatalf("invalid raw JSON: %s", string(raw))
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalizedRollbackSendsExpectedRelease(t *testing.T) {
|
||||
client := newTestClient(t, func(t *testing.T, req testRequest) testResponse {
|
||||
if req.Method != "localized.rollback" {
|
||||
|
||||
Reference in New Issue
Block a user