package dialectsfcrm

import (
	"context"
	"testing"

	"github.com/DATA-DOG/go-sqlmock"
	"github.com/nexuscrm/shared/pkg/contract"
)

func TestContentDistributionFileLookupIgnoresUnsupportedSourcesWithoutSQL(t *testing.T) {
	db, mock, err := sqlmock.New()
	if err != nil {
		t.Fatalf("sqlmock.New: %v", err)
	}
	defer db.Close()

	// Deliberately configure no expectations so any persistence access fails fast.
	lookup := NewContentDistributionFileLookup(db)
	result, found, err := lookup.LookupRecordAttachmentSource(context.Background(), contract.RecordAttachmentSourceRequest{
		ParentID:     "parent-1",
		SourceObject: "OtherSource",
		SourceField:  "IdBody",
		SourceValue:  "ABCDEF123456",
	})
	if err != nil {
		t.Fatalf("LookupRecordAttachmentSource err = %v", err)
	}
	if found || result != nil {
		t.Fatalf("LookupRecordAttachmentSource = (%#v, %v), want nil/false", result, found)
	}
	if err := mock.ExpectationsWereMet(); err != nil {
		t.Fatalf("unexpected SQL: %v", err)
	}
}
