psu/client/utils_test.go
Juan Carlos Mejías Rodríguez eaf7d2e5cf Enhance Portainer API error handling
2019-11-26 23:27:15 -05:00

47 lines
744 B
Go

package client
import (
"testing"
portainer "github.com/portainer/portainer/api"
"github.com/stretchr/testify/assert"
)
func TestGetTranslatedStackType(t *testing.T) {
type args struct {
t portainer.StackType
}
tests := []struct {
name string
args args
want string
}{
{
name: "swarm stack type",
args: args{
t: portainer.DockerSwarmStack,
},
want: "swarm",
},
{
name: "compose stack type",
args: args{
t: portainer.DockerComposeStack,
},
want: "compose",
},
{
name: "unknown stack type",
args: args{
t: 100,
},
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.want, GetTranslatedStackType(tt.args.t))
})
}
}