-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from appuio/zone-spec
Define Zone CRD spec
- Loading branch information
Showing
4 changed files
with
222 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package v1 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestUrlMap_GetURL(t *testing.T) { | ||
tests := map[string]struct { | ||
givenMap URLMap | ||
givenKey string | ||
expectedErr string | ||
expectedValue string | ||
}{ | ||
"GivenNil_ThenExpectError": { | ||
expectedErr: "map is nil", | ||
}, | ||
"GivenEmptyMap_WhenKeyNotPresent_ThenExpectError": { | ||
givenMap: URLMap{}, | ||
givenKey: "key", | ||
expectedErr: "key not found: key", | ||
}, | ||
"GivenMap_WhenKeyPresent_ThenParseUrl": { | ||
givenMap: URLMap{ | ||
"key": "https://hostname:80/path", | ||
}, | ||
givenKey: "key", | ||
expectedValue: "https://hostname:80/path", | ||
}, | ||
} | ||
for name, tt := range tests { | ||
t.Run(name, func(t *testing.T) { | ||
result, err := tt.givenMap.GetURL(tt.givenKey) | ||
if tt.expectedErr != "" { | ||
require.EqualError(t, err, tt.expectedErr) | ||
return | ||
} | ||
assert.Equal(t, tt.expectedValue, result.String()) | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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