Skip to content

GOWA - WhatsApp REST API with support for UI, Multi Account, Webhooks, and MCP, and Chatwoot. Built with Golang for efficient memory use.

935 B
Raw Blame
package usecase

import (
	"context"
	"testing"

	domainDevice "github.com/aldinokemal/go-whatsapp-web-multidevice/domains/device"
)

func TestDeviceServiceInterface(t *testing.T) {
	var _ domainDevice.IDeviceUsecase = (*serviceDevice)(nil)
}

func TestSetDeviceWebhook_InvalidManager(t *testing.T) {
	svc := &serviceDevice{manager: nil}
	err := svc.SetDeviceWebhook(context.Background(), "test-device", "https://example.com/webhook")
	if err == nil {
		t.Fatal("expected error when manager is nil")
	}
	if err.Error() != "device manager not initialized" {
		t.Fatalf("unexpected error: %v", err)
	}
}

func TestGetDeviceWebhook_InvalidManager(t *testing.T) {
	svc := &serviceDevice{manager: nil}
	_, err := svc.GetDeviceWebhook(context.Background(), "test-device")
	if err == nil {
		t.Fatal("expected error when manager is nil")
	}
	if err.Error() != "device manager not initialized" {
		t.Fatalf("unexpected error: %v", err)
	}
}