|
| 1 | +package codespace |
| 2 | + |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | +) |
| 6 | + |
| 7 | +func TestBuildDisplayName(t *testing.T) { |
| 8 | + tests := []struct { |
| 9 | + name string |
| 10 | + prebuildAvailability string |
| 11 | + expectedDisplayName string |
| 12 | + }{ |
| 13 | + { |
| 14 | + name: "prebuild availability is pool", |
| 15 | + prebuildAvailability: "pool", |
| 16 | + expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage (Prebuild ready)", |
| 17 | + }, |
| 18 | + { |
| 19 | + name: "prebuild availability is blob", |
| 20 | + prebuildAvailability: "blob", |
| 21 | + expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage (Prebuild ready)", |
| 22 | + }, |
| 23 | + { |
| 24 | + name: "prebuild availability is none", |
| 25 | + prebuildAvailability: "none", |
| 26 | + expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage", |
| 27 | + }, |
| 28 | + { |
| 29 | + name: "prebuild availability is empty", |
| 30 | + prebuildAvailability: "", |
| 31 | + expectedDisplayName: "4 cores, 8 GB RAM, 32 GB storage", |
| 32 | + }, |
| 33 | + } |
| 34 | + for _, tt := range tests { |
| 35 | + t.Run(tt.name, func(t *testing.T) { |
| 36 | + displayName := buildDisplayName("4 cores, 8 GB RAM, 32 GB storage", tt.prebuildAvailability) |
| 37 | + |
| 38 | + if displayName != tt.expectedDisplayName { |
| 39 | + t.Errorf("displayName = %q, expectedDisplayName %q", displayName, tt.expectedDisplayName) |
| 40 | + } |
| 41 | + }) |
| 42 | + } |
| 43 | +} |
0 commit comments