package member

import "testing"

func TestGetAccountTypeByCode(t *testing.T) {
	tests := []struct {
		code     string
		expected AccountType
	}{
		{"phone", AccountTypePhone},     // 測試有效值: 手機
		{"email", AccountTypeMail},      // 測試有效值: 信箱
		{"platform", AccountTypeDefine}, // 測試有效值: 自定義帳號
		{"unknown", AccountTypeNone},    // 測試無效值
		{"", AccountTypeNone},           // 測試空字串
		{"PHONE", AccountTypeNone},      // 測試大小寫不匹配
	}

	for _, tt := range tests {
		t.Run(tt.code, func(t *testing.T) {
			result := GetAccountTypeByCode(tt.code)
			if result != tt.expected {
				t.Errorf("GetAccountTypeByCode(%v) = %v, want %v", tt.code, result, tt.expected)
			}
		})
	}
}
