package repository

import "testing"

func TestNewSocialAccountRepository_AcceptsGormDB(t *testing.T) {
	db := openTestDB(t)

	repo, err := NewSocialAccountRepository(db)
	if err != nil {
		t.Fatalf("expected constructor to succeed: %v", err)
	}
	if repo == nil {
		t.Fatal("expected repository instance")
	}
}

func TestNewSocialAccountRepository_AcceptsSQLDB(t *testing.T) {
	db := openTestDB(t)
	sqlDB, err := db.DB()
	if err != nil {
		t.Fatalf("expected sql db handle: %v", err)
	}

	repo, err := NewSocialAccountRepository(sqlDB)
	if err != nil {
		t.Fatalf("expected constructor to succeed: %v", err)
	}
	if repo == nil {
		t.Fatal("expected repository instance")
	}
}

func TestNewSocialAccountRepository_RejectsUnsupportedType(t *testing.T) {
	repo, err := NewSocialAccountRepository(struct{}{})
	if err == nil {
		t.Fatal("expected constructor error")
	}
	if repo != nil {
		t.Fatal("did not expect repository instance")
	}
}
