"""Unit tests for account auth operations."""
from __future__ import annotations

import pytest

from account.bp.auth.services.auth_operations import validate_email


class TestValidateEmail:
    def test_valid_email(self):
        ok, email = validate_email("user@example.com")
        assert ok is True
        assert email == "user@example.com"

    def test_uppercase_lowered(self):
        ok, email = validate_email("USER@EXAMPLE.COM")
        assert ok is True
        assert email == "user@example.com"

    def test_whitespace_stripped(self):
        ok, email = validate_email("  user@example.com  ")
        assert ok is True
        assert email == "user@example.com"

    def test_empty_string(self):
        ok, email = validate_email("")
        assert ok is False

    def test_no_at_sign(self):
        ok, email = validate_email("notanemail")
        assert ok is False

    def test_just_at(self):
        ok, email = validate_email("@")
        assert ok is True  # has "@", passes the basic check

    def test_spaces_only(self):
        ok, email = validate_email("   ")
        assert ok is False
