forked from bwmarrin/discordgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs_test.go
36 lines (32 loc) · 859 Bytes
/
structs_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Discordgo - Discord bindings for Go
// Available at https://github.com/bwmarrin/discordgo
// Copyright 2015-2016 Bruce Marriner <[email protected]>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package discordgo
import (
"testing"
)
func TestMember_DisplayName(t *testing.T) {
user := &User{
GlobalName: "Global",
}
t.Run("no server nickname set", func(t *testing.T) {
m := &Member{
Nick: "",
User: user,
}
if dn := m.DisplayName(); dn != user.GlobalName {
t.Errorf("Member.DisplayName() = %v, want %v", dn, user.GlobalName)
}
})
t.Run("server nickname set", func(t *testing.T) {
m := &Member{
Nick: "Server",
User: user,
}
if dn := m.DisplayName(); dn != m.Nick {
t.Errorf("Member.DisplayName() = %v, want %v", dn, m.Nick)
}
})
}