Allow selecting transcript variants for rendering
This commit is contained in:
@@ -144,3 +144,40 @@ func TestRenderLoadAndValidate(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderVariantsConfiguration(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name, yaml string
|
||||
want []string
|
||||
invalid bool
|
||||
}{
|
||||
{"omitted", "", []string{"normalized", "trimmed"}, false},
|
||||
{"trimmed", "render:\n variants: [trimmed]\n", []string{"trimmed"}, false},
|
||||
{"empty", "render:\n variants: []\n", nil, false},
|
||||
{"null", "render:\n variants: null\n", nil, false},
|
||||
{"unknown", "render:\n variants: [other]\n", nil, true},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
pipeline, session := writeConfigFiles(t, testPipelineBaseYAML+"\n"+tc.yaml, testSessionBaseYAML)
|
||||
cfg, err := Load(pipeline, session)
|
||||
if tc.invalid {
|
||||
if err == nil {
|
||||
t.Fatal("expected unsupported variant error")
|
||||
}
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
got := cfg.Pipeline.Render.Variants
|
||||
if len(got) != len(tc.want) {
|
||||
t.Fatalf("variants %v, want %v", got, tc.want)
|
||||
}
|
||||
for i := range got {
|
||||
if got[i] != tc.want[i] {
|
||||
t.Fatalf("variants %v, want %v", got, tc.want)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user