46 lines
1.0 KiB
Go
46 lines
1.0 KiB
Go
package whatsapp
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
// --- MediaService tests ---
|
|
|
|
func TestNewMediaService(t *testing.T) {
|
|
ms := NewMediaService("https://graph.facebook.com/v18.0", "/tmp/test")
|
|
assert.NotNil(t, ms)
|
|
}
|
|
|
|
// --- Service tests ---
|
|
|
|
func TestNewWhatsAppService(t *testing.T) {
|
|
s := NewWhatsAppService(nil)
|
|
assert.NotNil(t, s)
|
|
}
|
|
|
|
// --- IncomingPipeline tests ---
|
|
|
|
func TestNewIncomingPipeline(t *testing.T) {
|
|
svc := NewWhatsAppService(nil)
|
|
p := NewIncomingPipeline(svc)
|
|
assert.NotNil(t, p)
|
|
}
|
|
|
|
// --- WhatsAppProvider identity tests ---
|
|
|
|
func TestWhatsAppProvider_CreateAndIdentity(t *testing.T) {
|
|
svc := NewWhatsAppService(nil)
|
|
repo := &Repository{}
|
|
pipeline := NewIncomingPipeline(svc)
|
|
p := NewWhatsAppProvider(svc, repo, pipeline)
|
|
assert.NotNil(t, p)
|
|
assert.Equal(t, "WhatsApp", p.Name())
|
|
assert.NotEmpty(t, p.Description())
|
|
assert.NotNil(t, p.DefaultConfig())
|
|
assert.NotNil(t, p.ConfigSchema())
|
|
caps := p.Capabilities()
|
|
assert.True(t, caps.SupportsAttachments)
|
|
}
|