Files
sm-bm-plugin/jobs/extract_material_text_test.go
Jakub Zych 412821ec56 feat: index the text of attached PDFs
- jz_bm_material_file_texts caches the pdftotext output per file
- the River job jz.bm.extract_material_text extracts and resyncs
- the management multipart attach queues it inside its transaction
- file_texts in the document and a file snippet with its name
2026-11-08 20:11:19 +01:00

30 lines
806 B
Go

package jobs_test
import (
"encoding/json"
"testing"
"git.golem15.com/jakub/sm-bm-plugin/jobs"
)
func TestExtractMaterialTextArgs(t *testing.T) {
args := jobs.ExtractMaterialTextArgs{MaterialID: 42}
if got := args.Kind(); got != "jz.bm.extract_material_text" {
t.Errorf("Kind = %q, want jz.bm.extract_material_text", got)
}
if jobs.ExtractMaterialTextKind != "jz.bm.extract_material_text" {
t.Errorf("ExtractMaterialTextKind = %q", jobs.ExtractMaterialTextKind)
}
b, err := json.Marshal(args)
if err != nil {
t.Fatal(err)
}
if string(b) != `{"material_id":42}` {
t.Errorf("JSON = %s, want {\"material_id\":42}", b)
}
var back jobs.ExtractMaterialTextArgs
if err := json.Unmarshal(b, &back); err != nil || back.MaterialID != 42 {
t.Errorf("round trip = %+v, %v", back, err)
}
}