0
0
mirror of https://github.com/thegeeklab/wp-docker-buildx.git synced 2024-11-13 22:50:41 +00:00
wp-docker-buildx/cmd/drone-docker-ecr/main_test.go
2018-02-10 11:41:07 -05:00

20 lines
581 B
Go

package main
import "testing"
func TestGetRepoName(t *testing.T) {
// map full repo path to expected repo name
repos := map[string]string{
"000000000000.dkr.ecr.us-east-1.amazonaws.com/repo": "repo",
"000000000000.dkr.ecr.us-east-1.amazonaws.com/namespace/repo": "namespace/repo",
"000000000000.dkr.ecr.us-east-1.amazonaws.com/namespace/namespace/repo": "namespace/namespace/repo",
}
for repo, name := range repos {
splitName := getRepoName(repo)
if splitName != name {
t.Errorf("%s is not equal to %s.", splitName, name)
}
}
}