(t *testing.T)
| 95 | } |
| 96 | |
| 97 | func 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 | |
| 130 | func TestForwardPortDefaultsToHTTPProtocol(t *testing.T) { |
| 131 | codespace := &api.Codespace{ |
nothing calls this directly
no test coverage detected