github.com/devcamcar/cli@v0.0.0-20181107134215-706a05759d18/common/bump_test.go (about)

     1  package common
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestCleanImageName(t *testing.T) {
     8  	testCases := []struct {
     9  		input    string
    10  		expected string
    11  	}{
    12  		{"someimage:latest", "someimage"},
    13  		{"repository/image/name:latest", "repository/image/name"},
    14  		{"repository:port/image/name:latest", "repository:port/image/name"},
    15  	}
    16  	for _, c := range testCases {
    17  		t.Run(c.input, func(t *testing.T) {
    18  			output := cleanImageName(c.input)
    19  			if output != c.expected {
    20  				t.Fatalf("Expected '%s' but got '%s'", c.expected, output)
    21  			}
    22  		})
    23  	}
    24  }