9
func TestDecode(t *testing.T) {
36
for idx, item := range tests {
37
t.Run(strconv.Itoa(idx), func(t *testing.T) {
38
model, err := Decode(item.hash, true)
40
t.Errorf("decode error: %s", err.Error())
44
if model.ID != item.id {
45
t.Errorf("%s : ID got %d; want %d", item.hash, model.ID, item.id)
47
if model.IsUser() != item.isUser {
48
t.Errorf("%s : wrong isUser detection", item.hash)
50
if model.IsMale() != item.isMale {
51
t.Errorf("%s : wrong isMale detection", item.hash)
57
func TestDecodeWithWrongOptions(t *testing.T) {
58
tests := []string{"NVMW17", "XR5LU6", "ZDMLHM", "4R6HQ3"}
60
for idx, item := range tests {
61
t.Run(strconv.Itoa(idx), func(t *testing.T) {
62
_, err := Decode(item, true)
64
if !errors.Is(err, WrongOptions) {
65
t.Errorf("decode error: %s", err.Error())
68
t.Errorf("decode error: ignore wrong options")
74
func TestDecodeNotAvatarWithWrongOptions(t *testing.T) {
75
tests := []string{"NVMW17", "XR5LU6", "ZDMLHM", "4R6HQ3"}
77
for idx, item := range tests {
78
t.Run(strconv.Itoa(idx), func(t *testing.T) {
79
_, err := Decode(item, false)
81
t.Errorf("decode error: %s", err.Error())