(t *testing.T)
| 227 | } |
| 228 | |
| 229 | func 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 | |
| 250 | func TestStripCacheTrackingFields(t *testing.T) { |
| 251 | tests := []struct { |
nothing calls this directly
no test coverage detected