MCPcopy Index your code
hub / github.com/cli/cli / TestIsInternalPort

Function TestIsInternalPort

internal/codespaces/portforwarder/port_forwarder_test.go:97–128  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestIsInternalPort(t *testing.T) {
98 internalPort := &tunnels.TunnelPort{
99 Labels: []string{"InternalPort"},
100 }
101 userForwardedPort := &tunnels.TunnelPort{
102 Labels: []string{"UserForwardedPort"},
103 }
104
105 tests := []struct {
106 name string
107 port *tunnels.TunnelPort
108 expected bool
109 }{
110 {
111 name: "internal",
112 port: internalPort,
113 expected: true,
114 },
115 {
116 name: "user-forwarded",
117 port: userForwardedPort,
118 expected: false,
119 },
120 }
121
122 for _, test := range tests {
123 t.Run(test.name, func(t *testing.T) {
124 isInternal := IsInternalPort(test.port)
125 assert.Equal(t, test.expected, isInternal)
126 })
127 }
128}
129
130func TestForwardPortDefaultsToHTTPProtocol(t *testing.T) {
131 codespace := &api.Codespace{

Callers

nothing calls this directly

Calls 3

IsInternalPortFunction · 0.85
EqualMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected