mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
add good tests for sip processors
This commit is contained in:
@@ -40,7 +40,38 @@ func TestGoodSipResponseAudioCreate(t *testing.T) {
|
|||||||
params map[string]any
|
params map[string]any
|
||||||
payload any
|
payload any
|
||||||
expected any
|
expected any
|
||||||
}{}
|
}{
|
||||||
|
{
|
||||||
|
name: "basic",
|
||||||
|
params: map[string]any{
|
||||||
|
"preWait": 0,
|
||||||
|
"audioFile": "good.wav",
|
||||||
|
"postWait": 0,
|
||||||
|
},
|
||||||
|
payload: nil,
|
||||||
|
expected: processor.SipAudioFileResponse{
|
||||||
|
PreWait: 0,
|
||||||
|
PostWait: 0,
|
||||||
|
AudioFile: "good.wav",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "template audio file",
|
||||||
|
params: map[string]any{
|
||||||
|
"preWait": 1,
|
||||||
|
"audioFile": "{{.Payload.SomeField}}.wav",
|
||||||
|
"postWait": 2,
|
||||||
|
},
|
||||||
|
payload: map[string]any{
|
||||||
|
"SomeField": "templated",
|
||||||
|
},
|
||||||
|
expected: processor.SipAudioFileResponse{
|
||||||
|
PreWait: 1,
|
||||||
|
PostWait: 2,
|
||||||
|
AudioFile: "templated.wav",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
|||||||
@@ -40,7 +40,36 @@ func TestGoodSipResponseDTMFCreate(t *testing.T) {
|
|||||||
params map[string]any
|
params map[string]any
|
||||||
payload any
|
payload any
|
||||||
expected any
|
expected any
|
||||||
}{}
|
}{
|
||||||
|
{
|
||||||
|
name: "basic",
|
||||||
|
params: map[string]any{
|
||||||
|
"preWait": 0,
|
||||||
|
"digits": "12345",
|
||||||
|
"postWait": 0,
|
||||||
|
},
|
||||||
|
payload: nil,
|
||||||
|
expected: processor.SipDTMFResponse{
|
||||||
|
PreWait: 0,
|
||||||
|
PostWait: 0,
|
||||||
|
Digits: "12345",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "template digits",
|
||||||
|
params: map[string]any{
|
||||||
|
"preWait": 0,
|
||||||
|
"digits": "{{.Payload}}",
|
||||||
|
"postWait": 0,
|
||||||
|
},
|
||||||
|
payload: "67890",
|
||||||
|
expected: processor.SipDTMFResponse{
|
||||||
|
PreWait: 0,
|
||||||
|
PostWait: 0,
|
||||||
|
Digits: "67890",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user