github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/contacts/phonebook_test.go (about) 1 // Copyright 2019 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package contacts 5 6 import ( 7 "testing" 8 9 "github.com/keybase/client/go/protocol/keybase1" 10 "github.com/stretchr/testify/require" 11 ) 12 13 func TestMakeAssertionToName(t *testing.T) { 14 contacts := []keybase1.ProcessedContact{ 15 { 16 Assertion: "[example@example.com]@email", 17 ContactName: "Example 1", 18 }, 19 { 20 Assertion: "1234567890@phone", 21 ContactName: "Mr. Contact", 22 }, 23 { 24 Assertion: "[example@example.com]@email", 25 ContactName: "Example 2", 26 }, 27 } 28 assertionToName := makeAssertionToName(contacts) 29 30 require.Contains(t, assertionToName, "1234567890@phone") 31 // Exclude ambiguous email 32 require.NotContains(t, assertionToName, "[example@example.com]@email") 33 }