package auth

import (
	"testing"

	authdomain "gateway/internal/model/auth/domain"

	"github.com/stretchr/testify/require"
)

func TestOAuthStateParsing(t *testing.T) {
	t.Parallel()

	regID, err := parseRegisterOAuthState(authdomain.OAuthStatePrefixRegister + "abc")
	require.NoError(t, err)
	require.Equal(t, "abc", regID)

	loginID, err := parseLoginOAuthState(authdomain.OAuthStatePrefixLogin + "xyz")
	require.NoError(t, err)
	require.Equal(t, "xyz", loginID)

	_, err = parseLoginOAuthState(authdomain.OAuthStatePrefixRegister + "abc")
	require.Error(t, err)
}
