@@ -103,6 +103,68 @@ defmodule Solapi.Message.ServiceTest do
103103
104104 assert { :error , % Solapi.Error.ValidationError { } } = result
105105 end
106+
107+ test "FAX 메시지 발송 (faxOptions 포함)" , % { bypass: bypass , client: client } do
108+ Bypass . expect ( bypass , "POST" , "/messages/v4/send-many/detail" , fn conn ->
109+ { :ok , body , conn } = Plug.Conn . read_body ( conn )
110+ decoded = Jason . decode! ( body )
111+
112+ message = hd ( decoded [ "messages" ] )
113+ assert message [ "to" ] == "0212345678"
114+ assert message [ "from" ] == "0312345678"
115+ assert message [ "faxOptions" ] [ "fileIds" ] == [ "file_id_123" , "file_id_456" ]
116+
117+ response = % {
118+ "groupId" => "G_FAX" ,
119+ "messageId" => "M_FAX"
120+ }
121+
122+ conn
123+ |> Plug.Conn . put_resp_content_type ( "application/json" )
124+ |> Plug.Conn . resp ( 200 , Jason . encode! ( response ) )
125+ end )
126+
127+ result =
128+ Service . send ( client , % {
129+ to: "0212345678" ,
130+ from: "0312345678" ,
131+ fax_options: % { fileIds: [ "file_id_123" , "file_id_456" ] }
132+ } )
133+
134+ assert { :ok , % { "messageId" => "M_FAX" } } = result
135+ end
136+
137+ test "음성 메시지 발송 (voiceOptions 포함)" , % { bypass: bypass , client: client } do
138+ Bypass . expect ( bypass , "POST" , "/messages/v4/send-many/detail" , fn conn ->
139+ { :ok , body , conn } = Plug.Conn . read_body ( conn )
140+ decoded = Jason . decode! ( body )
141+
142+ message = hd ( decoded [ "messages" ] )
143+ assert message [ "to" ] == "01012345678"
144+ assert message [ "from" ] == "0212345678"
145+ assert message [ "text" ] == "음성 메시지 테스트입니다."
146+ assert message [ "voiceOptions" ] [ "voiceType" ] == "FEMALE"
147+
148+ response = % {
149+ "groupId" => "G_VOICE" ,
150+ "messageId" => "M_VOICE"
151+ }
152+
153+ conn
154+ |> Plug.Conn . put_resp_content_type ( "application/json" )
155+ |> Plug.Conn . resp ( 200 , Jason . encode! ( response ) )
156+ end )
157+
158+ result =
159+ Service . send ( client , % {
160+ to: "01012345678" ,
161+ from: "0212345678" ,
162+ text: "음성 메시지 테스트입니다." ,
163+ voice_options: % { voiceType: "FEMALE" }
164+ } )
165+
166+ assert { :ok , % { "messageId" => "M_VOICE" } } = result
167+ end
106168 end
107169
108170 describe "send/1 with config" do
0 commit comments