chore(port-forward): support multiple port forwarded

This commit is contained in:
Quentin McGaw
2024-07-28 19:49:45 +00:00
parent 4c47b6f142
commit 8c730a6e4a
16 changed files with 147 additions and 57 deletions

View 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)
})
}
}