MCPcopy
hub / github.com/dosco/graphjin / TestResponseProcessor_NoDataField

Function TestResponseProcessor_NoDataField

core/cache_response_test.go:229–248  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

227}
228
229func TestResponseProcessor_NoDataField(t *testing.T) {
230 qc := &qcode.QCode{
231 Selects: []qcode.Select{},
232 }
233 rp := NewResponseProcessor(qc)
234
235 // Response without "data" field
236 input := []byte(`{"errors": [{"message": "something wrong"}]}`)
237 cleaned, refs, err := rp.ProcessForCache(input)
238 if err != nil {
239 t.Errorf("unexpected error: %v", err)
240 }
241 if len(refs) != 0 {
242 t.Errorf("expected no refs for error response, got %d", len(refs))
243 }
244 // Should return original input
245 if string(cleaned) != string(input) {
246 t.Errorf("expected original input returned")
247 }
248}
249
250func TestStripCacheTrackingFields(t *testing.T) {
251 tests := []struct {

Callers

nothing calls this directly

Calls 2

ProcessForCacheMethod · 0.95
NewResponseProcessorFunction · 0.85

Tested by

no test coverage detected