Added a new JSON public schema as the default output artifact
This commit is contained in:
@@ -81,6 +81,38 @@ func TestValidateOutputUsesMinimalSchemaWhenConfigured(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateOutputUsesSeriatimSchemaWhenConfigured(t *testing.T) {
|
||||
merged := model.MergedTranscript{
|
||||
Segments: []model.Segment{
|
||||
{
|
||||
ID: 1,
|
||||
Source: "input.json",
|
||||
SourceRef: "word-run:1:1:1",
|
||||
DerivedFrom: []string{"input.json#0"},
|
||||
Speaker: "Alice",
|
||||
Start: 1,
|
||||
End: 2,
|
||||
Text: "hello",
|
||||
Categories: []string{"backchannel"},
|
||||
OverlapGroupID: 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cfg := testConfig()
|
||||
cfg.OutputSchema = config.OutputSchemaSeriatim
|
||||
got, events, err := validateOutput{}.Process(context.Background(), merged, cfg)
|
||||
if err != nil {
|
||||
t.Fatalf("validate output: %v", err)
|
||||
}
|
||||
if len(got.Segments) != 1 {
|
||||
t.Fatalf("segment count = %d, want 1", len(got.Segments))
|
||||
}
|
||||
if len(events) != 1 || !strings.Contains(events[0].Message, "validated 1 output segment(s)") {
|
||||
t.Fatalf("events = %#v", events)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateOutputMinimalFailsBeforeAssignIDs(t *testing.T) {
|
||||
merged := model.MergedTranscript{
|
||||
Segments: []model.Segment{
|
||||
@@ -103,6 +135,7 @@ func testConfig() config.Config {
|
||||
return config.Config{
|
||||
InputReader: config.DefaultInputReader,
|
||||
InputFiles: []string{"input.json"},
|
||||
OutputSchema: config.DefaultOutputSchema,
|
||||
PreprocessingModules: []string{"validate-raw", "normalize-speakers", "trim-text"},
|
||||
PostprocessingModules: []string{"assign-ids", "validate-output"},
|
||||
OutputModules: []string{"json"},
|
||||
|
||||
Reference in New Issue
Block a user