MCPcopy Create free account
hub / github.com/diillson/chatcli / TestDetectImageMediaType

Function TestDetectImageMediaType

models/image_test.go:46–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestDetectImageMediaType(t *testing.T) {
47 if mt, ok := DetectImageMediaType(onePxPNG); !ok || mt != "image/png" {
48 t.Errorf("PNG detect = (%q,%v), want image/png,true", mt, ok)
49 }
50 if _, ok := DetectImageMediaType([]byte("not an image at all")); ok {
51 t.Error("plain text must not detect as image")
52 }
53 if _, ok := DetectImageMediaType(nil); ok {
54 t.Error("empty must not detect")
55 }
56}
57
58func TestSupportedImageMediaTypes(t *testing.T) {
59 got := SupportedImageMediaTypes()

Callers

nothing calls this directly

Calls 3

DetectImageMediaTypeFunction · 0.85
ErrorfMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected