27 lines
1.2 KiB
Go
27 lines
1.2 KiB
Go
package validator
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"browser.local/platform/domain"
|
|
)
|
|
|
|
func TestValidateGamePluginRuntimeProfilesRejectsLegacySteamCMDAppStep(t *testing.T) {
|
|
profiles := domain.GamePluginRuntimeProfiles{InstallPlans: []domain.RuntimeInstallPlan{{Key: "install-game", Title: "Install game", Steps: []domain.RuntimeInstallStep{{Type: "steamcmd-app", TargetKey: "server/install-root", PackageManager: "steamcmd", PackageName: "123456"}}}}}
|
|
|
|
err := ValidateGamePluginRuntimeProfiles(profiles)
|
|
if err == nil || !strings.Contains(err.Error(), "type is invalid") {
|
|
t.Fatalf("expected legacy steamcmd-app step rejection, got %v", err)
|
|
}
|
|
}
|
|
|
|
func TestValidateGamePluginRuntimeProfilesRejectsManualStepExecutionFields(t *testing.T) {
|
|
profiles := domain.GamePluginRuntimeProfiles{InstallPlans: []domain.RuntimeInstallPlan{{Key: "manual-plan", Title: "Manual plan", Steps: []domain.RuntimeInstallStep{{Type: "manual", TargetKey: "operator/manual", PackageManager: "steamcmd"}}}}}
|
|
|
|
err := ValidateGamePluginRuntimeProfiles(profiles)
|
|
if err == nil || !strings.Contains(err.Error(), "manual step cannot contain machine execution fields") {
|
|
t.Fatalf("expected manual execution field rejection, got %v", err)
|
|
}
|
|
}
|