//go:build mysql // +build mysql package mysql import ( "testing" "github.com/tinode/chat/server/store/types" ) func TestParseFileUIDStripsPublicExtension(t *testing.T) { uid := types.ParseUid("scH0N8guCHk") if uid.IsZero() { t.Fatal("test UID failed to parse") } if got := parseFileUID("scH0N8guCHk.bin"); got != uid { t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String()) } if got := parseFileUID("scH0N8guCHk.jpg"); got != uid { t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String()) } if got := parseFileUID("scH0N8guCHk"); got != uid { t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String()) } }