Skip to content
quarry Artifact [06f5f4a433]
Login

Artifact [06f5f4a433]

Artifact 06f5f4a433337152314c366cbf848b6d8381af19ae509612652303008ef106f0:


package api

import "testing"

// The image types a document may reference are served as bytes. SVG joined
// them once the web route began answering it under a sandboxing policy.
func TestDocDirectTypes(t *testing.T) {
	for path, want := range map[string]string{
		"a.png":            "image/png",
		"dir/a.JPG":        "image/jpeg",
		"a.jpeg":           "image/jpeg",
		"a.gif":            "image/gif",
		"docs/mark.svg":    "image/svg+xml",
		"docs/mark.SVG":    "image/svg+xml",
		"docs/mark.svgz":   "",
		"docs/mark.svg.md": "",
		"Makefile":         "",
	} {
		got, ok := docDirect(path)
		if got != want || ok != (want != "") {
			t.Errorf("FAIL: docDirect(%q) = %q,%v; want %q", path, got, ok, want)
		}
	}
}