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

Function TestResponseProcessor_EmptyData

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

Source from the content-addressed store, hash-verified

195}
196
197func TestResponseProcessor_EmptyData(t *testing.T) {
198 // Create a minimal qcode for testing
199 qc := &qcode.QCode{
200 Selects: []qcode.Select{},
201 }
202 rp := NewResponseProcessor(qc)
203
204 // Empty data should return empty
205 cleaned, refs, err := rp.ProcessForCache(nil)
206 if err != nil {
207 t.Errorf("unexpected error: %v", err)
208 }
209 if len(cleaned) != 0 {
210 t.Errorf("expected empty cleaned data, got %s", cleaned)
211 }
212 if len(refs) != 0 {
213 t.Errorf("expected no refs, got %d", len(refs))
214 }
215
216 // Empty byte slice
217 cleaned, refs, err = rp.ProcessForCache([]byte{})
218 if err != nil {
219 t.Errorf("unexpected error: %v", err)
220 }
221 if len(cleaned) != 0 {
222 t.Errorf("expected empty cleaned data")
223 }
224 if len(refs) != 0 {
225 t.Errorf("expected no refs")
226 }
227}
228
229func TestResponseProcessor_NoDataField(t *testing.T) {
230 qc := &qcode.QCode{

Callers

nothing calls this directly

Calls 2

ProcessForCacheMethod · 0.95
NewResponseProcessorFunction · 0.85

Tested by

no test coverage detected