Fix SCUM config manifest refresh
This commit is contained in:
@@ -2011,6 +2011,35 @@ func TestCoreServiceUpsertsDuplicateGamePluginManifest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceRefreshesSameVersionPluginManifestDeclarations(t *testing.T) {
|
||||
svc := newTestCoreService()
|
||||
registration := validPluginManifestRegistration()
|
||||
registration.Manifest.FileWorkspace = domain.PluginFileWorkspace{
|
||||
DefaultDirectoryKey: "config",
|
||||
Directories: []domain.PluginLogicalDirectory{{Key: "config", Label: "配置", Scope: "config"}},
|
||||
Files: []domain.PluginLogicalFile{{Key: "settings", DirectoryKey: "config", Label: "Settings.ini", Kind: "config", Editable: true}},
|
||||
}
|
||||
if _, err := svc.RegisterGamePluginManifest(registration); err != nil {
|
||||
t.Fatalf("register legacy manifest: %v", err)
|
||||
}
|
||||
|
||||
registration.Manifest.FileWorkspace.Files[0].TargetKey = "SCUM/Saved/Config/WindowsServer/ServerSettings.ini"
|
||||
refreshed, err := svc.RegisterGamePluginManifest(registration)
|
||||
if err != nil {
|
||||
t.Fatalf("refresh same-version manifest: %v", err)
|
||||
}
|
||||
if len(refreshed.FileWorkspace.Files) != 1 || refreshed.FileWorkspace.Files[0].TargetKey != "SCUM/Saved/Config/WindowsServer/ServerSettings.ini" {
|
||||
t.Fatalf("expected same-version manifest declaration to refresh, got %+v", refreshed.FileWorkspace)
|
||||
}
|
||||
stored, err := svc.store.GamePlugins().Get(registration.Manifest.ID)
|
||||
if err != nil {
|
||||
t.Fatalf("load refreshed manifest: %v", err)
|
||||
}
|
||||
if stored.FileWorkspace.Files[0].TargetKey != refreshed.FileWorkspace.Files[0].TargetKey {
|
||||
t.Fatalf("expected stored manifest target to refresh, stored=%+v refreshed=%+v", stored.FileWorkspace, refreshed.FileWorkspace)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCoreServiceKeepsOnlyLatestPluginVersionAndMigratesReferences(t *testing.T) {
|
||||
svc := newTestCoreService()
|
||||
stale := validPluginManifestRegistration()
|
||||
|
||||
Reference in New Issue
Block a user