Files
multiarch-docker-images/archivist/internal/pipeline/pipeline_test.go
T
1224ff916d Archivist : page Outils + outil « Recherche des fichiers perdus » (US-40, US-41) (#16)
* Add tools page with find-lost-files consistency tool (US-40, US-41)

Co-authored-by: napnap75 <napnap75@users.noreply.github.com>

* tools page: hide the job panel when there is nothing to show, guard against undefined rendering

Co-authored-by: napnap75 <napnap75@users.noreply.github.com>

* inbox: leave non-PDF objects in place, never imported (US-12)

Co-authored-by: napnap75 <napnap75@users.noreply.github.com>

---------

Co-authored-by: Vibe Nuage Agent <vibe@mistral.ai>
Co-authored-by: napnap75 <napnap75@users.noreply.github.com>
2026-11-12 19:35:56 +01:00

25 lines
673 B
Go

package pipeline
import "testing"
// TestIsPDF covers the inbox rule: only content carrying the %PDF- header
// enters the pipeline; anything else is left in place (US-12).
func TestIsPDF(t *testing.T) {
cases := []struct {
name string
data []byte
want bool
}{
{"pdf header", []byte("%PDF-1.7\n..."), true},
{"pdf header with leading whitespace", []byte("\n%PDF-1.4"), false},
{"plain text", []byte("not a pdf at all\n"), false},
{"image content", []byte("\x89PNG\r\n\x1a\n..."), false},
{"empty", nil, false},
}
for _, c := range cases {
if got := isPDF(c.data); got != c.want {
t.Errorf("%s: isPDF = %v, want %v", c.name, got, c.want)
}
}
}