package practicecontent import ( "Yimaru-Backend/internal/domain" "testing" ) func TestBuildQuestionInput_dynamicAudioOnly(t *testing.T) { item := domain.FullUpdatePracticeQuestionItem{ QuestionType: strPtr("DYNAMIC"), QuestionTypeDefinitionID: int64Ptr(20), DynamicPayload: &domain.DynamicQuestionPayload{ Stimulus: []domain.DynamicElementInstance{ {ID: "audio_prompt_1", Kind: "AUDIO_PROMPT", Value: "https://cdn.example.com/prompt.mp3"}, }, Response: []domain.DynamicElementInstance{ {ID: "answer_timer_1", Kind: "ANSWER_TIMER", Value: map[string]interface{}{"seconds": 30}}, {ID: "audio_response_1", Kind: "AUDIO_RESPONSE"}, }, }, } def := domain.QuestionTypeDefinition{ StimulusComponentKinds: []string{"AUDIO_PROMPT"}, ResponseComponentKinds: []string{"ANSWER_TIMER", "AUDIO_RESPONSE"}, } got, err := buildQuestionInput(item, nil, func(id int64) (domain.QuestionTypeDefinition, error) { return def, nil }) if err != nil { t.Fatalf("unexpected error: %v", err) } if got.QuestionType != "DYNAMIC" { t.Fatalf("expected DYNAMIC, got %q", got.QuestionType) } if got.QuestionText != "" { t.Fatalf("expected empty stored text, got %q", got.QuestionText) } } func strPtr(s string) *string { return &s } func int64Ptr(v int64) *int64 { return &v }