package common

import (
	"testing"
)

func TestUserSourceConstants(t *testing.T) {
	if UserSourceLocal != "local" {
		t.Errorf("UserSourceLocal = %q, want %q", UserSourceLocal, "local")
	}
	if UserSourceSynced != "synced" {
		t.Errorf("UserSourceSynced = %q, want %q", UserSourceSynced, "synced")
	}
}

func TestIsSyncedUser(t *testing.T) {
	tests := []struct {
		name   string
		source string
		want   bool
	}{
		{"synced source", UserSourceSynced, true},
		{"local source", UserSourceLocal, false},
		{"empty source", "", false},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := IsSyncedUser(tt.source); got != tt.want {
				t.Errorf("IsSyncedUser(%q) = %v, want %v", tt.source, got, tt.want)
			}
		})
	}
}

func TestIsLocalUser(t *testing.T) {
	tests := []struct {
		name   string
		source string
		want   bool
	}{
		{"local source", UserSourceLocal, true},
		{"empty source", "", true},
		{"synced source", UserSourceSynced, false},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if got := IsLocalUser(tt.source); got != tt.want {
				t.Errorf("IsLocalUser(%q) = %v, want %v", tt.source, got, tt.want)
			}
		})
	}
}
