feat: validate and activate AI table bindings
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user