MCPcopy
hub / github.com/coder/websocket / Test_validWireCloseCode

Function Test_validWireCloseCode

close_test.go:125–169  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func Test_validWireCloseCode(t *testing.T) {
126 t.Parallel()
127
128 testCases := []struct {
129 name string
130 code StatusCode
131 valid bool
132 }{
133 {
134 name: "normal",
135 code: StatusNormalClosure,
136 valid: true,
137 },
138 {
139 name: "noStatus",
140 code: StatusNoStatusRcvd,
141 valid: false,
142 },
143 {
144 name: "3000",
145 code: 3000,
146 valid: true,
147 },
148 {
149 name: "4999",
150 code: 4999,
151 valid: true,
152 },
153 {
154 name: "unknown",
155 code: 5000,
156 valid: false,
157 },
158 }
159
160 for _, tc := range testCases {
161 tc := tc
162 t.Run(tc.name, func(t *testing.T) {
163 t.Parallel()
164
165 act := validWireCloseCode(tc.code)
166 assert.Equal(t, "wire close code", tc.valid, act)
167 })
168 }
169}
170
171func TestCloseStatus(t *testing.T) {
172 t.Parallel()

Callers

nothing calls this directly

Calls 2

EqualFunction · 0.92
validWireCloseCodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…