github.com/databricks/cli@v0.203.0/bundle/config/mutator/populate_current_user_test.go (about) 1 package mutator 2 3 import "testing" 4 5 func TestPopulateCurrentUser(t *testing.T) { 6 // We need to implement workspace client mocking to implement this test. 7 } 8 9 func TestGetShortUserName(t *testing.T) { 10 tests := []struct { 11 name string 12 email string 13 expected string 14 }{ 15 { 16 name: "test alphanumeric characters", 17 email: "test.user@example.com", 18 expected: "test_user", 19 }, 20 { 21 name: "test unicode characters", 22 email: "tést.üser@example.com", 23 expected: "tést_üser", 24 }, 25 { 26 name: "test special characters", 27 email: "test$.user@example.com", 28 expected: "test__user", 29 }, 30 } 31 32 for _, tt := range tests { 33 t.Run(tt.name, func(t *testing.T) { 34 result := getShortUserName(tt.email) 35 if result != tt.expected { 36 t.Errorf("getShortUserName(%q) = %q; expected %q", tt.email, result, tt.expected) 37 } 38 }) 39 } 40 }