package html_test import ( "bytes" "strings" "testing" "github.com/nmoniz/any2anexoj/internal/writing" htmlwriter "github.com/nmoniz/any2anexoj/internal/writing/html" ) // TestWriter_RenderTableFragment renders a Portuguese document and asserts // the embedded report table fragment carries the shared structure: the // translated headers, the totals footer, and the strictly proportional // colgroup that keeps HTML columns in the same relation to each other as // the terminal layout. func TestWriter_RenderTableFragment(t *testing.T) { aw := buildTestAggregator(t) localizer, err := writing.NewLocalizer("pt") if err != nil { t.Fatalf("failed to create localizer: %v", err) } var buf bytes.Buffer hw := htmlwriter.NewWriter(&buf, localizer, "pt") if err := hw.Render(aw); err != nil { t.Fatalf("Render returned an error: %v", err) } got := buf.String() wantSubstrings := []string{ `