fix: stop enqueueing disabled external table exports
This commit is contained in:
@@ -59,9 +59,12 @@ func TestShouldEnqueueQuestionTableExportOnlyForDingTalkSucceededAnswers(t *test
|
||||
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
if got := shouldEnqueueQuestionTableExport(tc.turn); got != tc.want {
|
||||
if got := shouldEnqueueQuestionTableExport(tc.turn, true); got != tc.want {
|
||||
t.Fatalf("shouldEnqueueQuestionTableExport()=%v, want %v", got, tc.want)
|
||||
}
|
||||
if got := shouldEnqueueQuestionTableExport(tc.turn, false); got {
|
||||
t.Fatal("disabled question-table export must not enqueue")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -188,8 +191,8 @@ func TestFinishTurnOutboxGuardedByShouldCreateAnswerMessage(t *testing.T) {
|
||||
if !strings.Contains(guardBlock, "question_table_exports") {
|
||||
t.Error("question_table_exports INSERT must be inside the shouldCreateAnswerMessage guard block")
|
||||
}
|
||||
if !strings.Contains(guardBlock, "if shouldEnqueueQuestionTableExport(turn) {") {
|
||||
t.Error("question_table_exports INSERT must be guarded to DingTalk turns explicitly")
|
||||
if !strings.Contains(guardBlock, "if shouldEnqueueQuestionTableExport(turn, s.questionTableExportEnabled) {") {
|
||||
t.Error("question_table_exports INSERT must require both runtime enablement and a DingTalk turn")
|
||||
}
|
||||
|
||||
// The guard block must be the one that contains the messages INSERT
|
||||
|
||||
Reference in New Issue
Block a user