| 1 | package permissionpreset |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestLegacyMigrationIsConservative(t *testing.T) { |
| 6 | tests := map[string]Preset{ |
| 7 | "ask": ReadOnly, "auto": WorkspaceWrite, "yolo": WorkspaceWrite, |
| 8 | "read-only": ReadOnly, "workspace-write": WorkspaceWrite, |
| 9 | "danger-full-access": DangerFullAccess, |
| 10 | "dontAsk": ReadOnly, "unknown": ReadOnly, |
| 11 | } |
| 12 | for input, want := range tests { |
| 13 | if got := Normalize(input); got != want { |
| 14 | t.Fatalf("Normalize(%q) = %q, want %q", input, got, want) |
| 15 | } |
| 16 | } |
| 17 | if got := NormalizeDefault(""); got != WorkspaceWrite { |
| 18 | t.Fatalf("NormalizeDefault(empty) = %q", got) |
| 19 | } |
| 20 | } |
| 21 |