MCPcopy
hub / github.com/tinode/chat / verifyResponseCodes

Function verifyResponseCodes

server/session_test.go:80–96  ·  view source on GitHub ↗
(r *responses, codes []int, t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func verifyResponseCodes(r *responses, codes []int, t *testing.T) {
81 if len(r.messages) != len(codes) {
82 t.Errorf("responses: expected %d, received %d.", len(codes), len(r.messages))
83 }
84 for i := range codes {
85 resp := r.messages[i].(*ServerComMessage)
86 if resp == nil {
87 t.Fatalf("Response %d must be ServerComMessage", i)
88 }
89 if resp.Ctrl == nil {
90 t.Fatalf("Response %d must contain a ctrl message.", i)
91 }
92 if resp.Ctrl.Code != codes[i] {
93 t.Errorf("Response code: expected %d, got %d", codes[i], resp.Ctrl.Code)
94 }
95 }
96}
97
98func TestDispatchInvalidVersion(t *testing.T) {
99 s := &Session{

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…