Review normalize command architecture
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
All checks were successful
ci/woodpecker/tag/release Pipeline was successful
This commit is contained in:
@@ -349,6 +349,31 @@ func TestNormalizeReportIncludesBareArrayShape(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNormalizeReportDoesNotIncludeTranscriptText(t *testing.T) {
|
||||||
|
dir := t.TempDir()
|
||||||
|
const segmentText = "normalize-report-secret-text"
|
||||||
|
input := writeJSONFile(t, dir, "input.json", `[{"start":1,"end":2,"speaker":"A","text":"`+segmentText+`"}]`)
|
||||||
|
output := filepath.Join(dir, "normalized.json")
|
||||||
|
reportPath := filepath.Join(dir, "report.json")
|
||||||
|
|
||||||
|
err := executeNormalize(
|
||||||
|
"--input-file", input,
|
||||||
|
"--output-file", output,
|
||||||
|
"--report-file", reportPath,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("normalize failed: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
var rpt report.Report
|
||||||
|
readJSON(t, reportPath, &rpt)
|
||||||
|
for _, event := range rpt.Events {
|
||||||
|
if strings.Contains(event.Message, segmentText) {
|
||||||
|
t.Fatalf("report unexpectedly contained transcript text in event %#v", event)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestNormalizeReportEmptyInputEmitsWarning(t *testing.T) {
|
func TestNormalizeReportEmptyInputEmitsWarning(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
input := writeJSONFile(t, dir, "input.json", `{"segments":[]}`)
|
input := writeJSONFile(t, dir, "input.json", `{"segments":[]}`)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
func NewRootCommand() *cobra.Command {
|
func NewRootCommand() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "seriatim",
|
Use: "seriatim",
|
||||||
Short: "Merge per-speaker transcripts into a chronological transcript",
|
Short: "Merge, trim, and normalize transcript artifacts",
|
||||||
Version: buildinfo.Version,
|
Version: buildinfo.Version,
|
||||||
SilenceErrors: true,
|
SilenceErrors: true,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ func TestParseReaderSegmentsNotArrayFails(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParseReaderTopLevelScalarShapesFail(t *testing.T) {
|
func TestParseReaderTopLevelScalarShapesFail(t *testing.T) {
|
||||||
tests := []string{`"text"`, `42`, `null`}
|
tests := []string{`"text"`, `42`, `null`, `true`}
|
||||||
for _, input := range tests {
|
for _, input := range tests {
|
||||||
_, err := ParseReader(strings.NewReader(input))
|
_, err := ParseReader(strings.NewReader(input))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user