Align validator identity and span domain checks
This commit is contained in:
@@ -109,6 +109,26 @@ func TestApplyProposalsStaleProposalSkippedAfterEarlierChange(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyProposalsRechecksBlankResultAfterEarlierDeletion(t *testing.T) {
|
||||
transcript := &schema.Transcript{Segments: []schema.Segment{{ID: 1, Text: "a b"}}}
|
||||
proposed := []EnrichedCorrectionProposal{
|
||||
{CorrectionProposal: CorrectionProposal{TargetSegmentID: 1, OriginalText: "a", CorrectedText: "", Confidence: 1}, ProposalMetadata: ProposalMetadata{ProposalIndex: 0}},
|
||||
{CorrectionProposal: CorrectionProposal{TargetSegmentID: 1, OriginalText: "b", CorrectedText: "", Confidence: 1}, ProposalMetadata: ProposalMetadata{ProposalIndex: 1}},
|
||||
}
|
||||
for _, candidate := range proposed {
|
||||
if preview := PreviewProposalForSegment(&transcript.Segments[0], candidate.CorrectionProposal, ReplacementPolicyRequireUnique); !preview.Applicable {
|
||||
t.Fatalf("proposal must be initially applicable: %+v", preview)
|
||||
}
|
||||
}
|
||||
result := ApplyProposals(transcript, proposed, ReplacementPolicyRequireUnique)
|
||||
if got := result.Transcript.Segments[0].Text; got != " b" {
|
||||
t.Fatalf("expected literal surviving text, got %q", got)
|
||||
}
|
||||
if len(result.Applied) != 1 || len(result.Skipped) != 1 || result.Skipped[0].SkipReason != SkipReasonEmptyResultingText {
|
||||
t.Fatalf("expected second deletion skipped after reevaluation: %+v", result)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyProposalsMissingSegmentSkip(t *testing.T) {
|
||||
transcript := &schema.Transcript{Segments: []schema.Segment{{ID: 1, Text: "hello"}}}
|
||||
proposals := []EnrichedCorrectionProposal{
|
||||
|
||||
Reference in New Issue
Block a user