package logger

import (
	"testing"

	"github.com/fiskerinc/cloud-services/pkg/testhelper"
)

func TestMaskEmailEasy(t *testing.T) {
	email := "dtaylor@fiskerinc.com"
	expected := "d******@fiskerinc.com"
	masked := MaskEmail(email)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskEmailEasy", expected, masked)
	}
}

func TestMaskEmailMed(t *testing.T) {
	email := "d.taylor@fiskerinc.com"
	expected := "d*******@fiskerinc.com"
	masked := MaskEmail(email)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskEmailMed", expected, masked)
	}
}

func TestMaskEmailHard(t *testing.T) {
	email := "d!-taylor@fiskerinc.com"
	expected := "d********@fiskerinc.com"
	masked := MaskEmail(email)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskEmailHard", expected, masked)
	}
}

func TestMaskPassword(t *testing.T) {
	password := "abc123!"
	expected := "*******"
	masked := MaskPassword(password)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskPassword", expected, masked)
	}
}

func TestMaskPhoneNumberEasy(t *testing.T) {
	phone := "1234567890"
	expected := "1*********"
	masked := MaskPhoneNumber(phone)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskPhoneNumberEasy", expected, masked)
	}
}

func TestMaskPhoneNumberMed(t *testing.T) {
	phone := "+1234567890"
	expected := "+1*********"
	masked := MaskPhoneNumber(phone)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskPhoneNumberMed", expected, masked)
	}
}

func TestMaskPhoneNumberHard(t *testing.T) {
	phone := "+1(123)456-7890"
	expected := "+1(1**)4**-7***"
	masked := MaskPhoneNumber(phone)

	if masked != expected {
		t.Errorf(testhelper.TestErrorTemplate, "TestMaskPhoneNumberHard", expected, masked)
	}
}
