28 lines
1.0 KiB
Go
28 lines
1.0 KiB
Go
package proposal_generation
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.maximumdirect.net/eric/audita/internal/core/schema"
|
|
)
|
|
|
|
func TestBuildProposalVariablesPreservesSectionGlossaryAndDescription(t *testing.T) {
|
|
transcript := &schema.Transcript{Segments: []schema.Segment{{ID: 1, Speaker: "A", Start: 0, End: 1, Text: "gestures"}}}
|
|
glossary := &schema.Glossary{Entries: []schema.GlossaryEntry{{Name: "Jesters"}}}
|
|
variables, err := BuildProposalVariables(transcript, glossary, 0, " Fantasy names ")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.Contains(variables["SectionJSON"], `"section_index": 0`) || !strings.Contains(variables["SectionJSON"], "gestures") || !strings.Contains(variables["GlossaryJSON"], "Jesters") || !strings.Contains(variables["TranscriptDescriptionBlock"], "Fantasy names") {
|
|
t.Fatalf("encoded variables incomplete: %+v", variables)
|
|
}
|
|
empty, err := BuildProposalVariables(transcript, glossary, 0, " ")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if empty["TranscriptDescriptionBlock"] != "" {
|
|
t.Fatal("empty description added guidance")
|
|
}
|
|
}
|