package email

import (
	"fmt"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestEmailQueue(t *testing.T) {
	queue := NewEmailQueue(100, 14, &TestEmailClient{})

	// Start the queue processing
	queue.Start()

	// Enqueue some emails
	for i := 1; i <= 28; i++ {
		email := Email{
			Sender:    "test@example.com",
			Recipient: fmt.Sprintf("user%d@example.com", i),
			Subject:   "test subject",
			Content:   "This is a test email",
		}
		queue.AddEmail(email)
	}
	// Stop the queue after all emails are processed
	queue.Stop()

	assert.Equal(t, queue.FailedSendCount, 0)
}
