chore(port-forward): support multiple port forwarded
This commit is contained in:
43
internal/portforward/service/helpers_test.go
Normal file
43
internal/portforward/service/helpers_test.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func Test_portsToString(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := map[string]struct {
|
||||
ports []uint16
|
||||
s string
|
||||
}{
|
||||
"no_port": {
|
||||
s: "no port forwarded",
|
||||
},
|
||||
"one_port": {
|
||||
ports: []uint16{123},
|
||||
s: "port forwarded is 123",
|
||||
},
|
||||
"two_ports": {
|
||||
ports: []uint16{123, 456},
|
||||
s: "ports forwarded are 123 and 456",
|
||||
},
|
||||
"three_ports": {
|
||||
ports: []uint16{123, 456, 789},
|
||||
s: "ports forwarded are 123, 456 and 789",
|
||||
},
|
||||
}
|
||||
|
||||
for name, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
s := portsToString(testCase.ports)
|
||||
|
||||
assert.Equal(t, testCase.s, s)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user