feat: validate and activate AI table bindings

This commit is contained in:
姚章浩
2026-08-13 13:14:06 +08:00
parent a7432aed49
commit 0fc64ba77d
11 changed files with 362 additions and 39 deletions
+14
View File
@@ -0,0 +1,14 @@
package questiontable
import "testing"
func TestRemapFieldsUsesValidatedLogicalMapping(t *testing.T) {
client := &Client{fieldMapping: map[string]string{"answer": "new-answer", "original_question": "new-question"}}
got := client.remapFields(map[string]interface{}{FieldAnswer: "A", FieldOriginalQuestion: "Q"})
if got["new-answer"] != "A" || got["new-question"] != "Q" {
t.Fatalf("got=%#v", got)
}
if _, ok := got[FieldAnswer]; ok {
t.Fatal("legacy field id must not remain when mapping exists")
}
}