-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added validation to ensure that a specific environment is selected wh…
…en using local apply
- Loading branch information
1 parent
34ddc10
commit dd9dc70
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package myks | ||
|
||
import "testing" | ||
|
||
func TestGlobe_SingleEnv(t *testing.T) { | ||
type fields struct { | ||
environments map[string]*Environment | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
want bool | ||
}{ | ||
{"before init", fields{map[string]*Environment{}}, false}, | ||
{"happy path", fields{map[string]*Environment{"test-env": {}}}, true}, | ||
{"sad path", fields{map[string]*Environment{"test-env": {}, "test-env2": {}}}, false}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
g := &Globe{ | ||
environments: tt.fields.environments, | ||
} | ||
if got := g.SingleEnv(); got != tt.want { | ||
t.Errorf("SingleEnv() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |