Default off; malformed or risk downgrade forces deterministic report. Co-authored-by: Cursor <cursoragent@cursor.com>
25 lines
716 B
Go
25 lines
716 B
Go
package docrevision
|
|
|
|
import "testing"
|
|
|
|
func TestPINarrativeFlagDefaultOff(t *testing.T) {
|
|
t.Setenv("PI_CHANGE_REPORT_NARRATIVE", "")
|
|
if PIChangeReportNarrativeEnabled() {
|
|
t.Fatal("default off")
|
|
}
|
|
det := `{"ok":true}`
|
|
got := SelectChangeReportJSON(`{"pi":true}`, det, "a", "b", "low", nil, nil)
|
|
if got != det {
|
|
t.Fatalf("flag off must use deterministic, got %s", got)
|
|
}
|
|
}
|
|
|
|
func TestPINarrativeMalformedFallsBack(t *testing.T) {
|
|
t.Setenv("PI_CHANGE_REPORT_NARRATIVE", "1")
|
|
det := BuildDeterministicChangeReportJSON("from", "to", "medium", nil, DiffResult{})
|
|
got := SelectChangeReportJSON("{not-json", det, "from", "to", "medium", nil, nil)
|
|
if got != det {
|
|
t.Fatal("malformed must full fallback")
|
|
}
|
|
}
|