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") } }