-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
util_test.go
66 lines (57 loc) · 1.51 KB
/
util_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2022 Ainsley Clark. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package errors
import (
"reflect"
"testing"
)
func TestNewInternal(t *testing.T) {
got := NewInternal(nil, "message", "op")
want := INTERNAL
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewConflict(t *testing.T) {
got := NewConflict(nil, "message", "op")
want := CONFLICT
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewInvalid(t *testing.T) {
got := NewInvalid(nil, "message", "op")
want := INVALID
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewNotFound(t *testing.T) {
got := NewNotFound(nil, "message", "op")
want := NOTFOUND
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewUnknown(t *testing.T) {
got := NewUnknown(nil, "message", "op")
want := UNKNOWN
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewMaximumAttempts(t *testing.T) {
got := NewMaximumAttempts(nil, "message", "op")
want := MAXIMUMATTEMPTS
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}
func TestNewExpired(t *testing.T) {
got := NewExpired(nil, "message", "op")
want := EXPIRED
if !reflect.DeepEqual(want, got.Code) {
t.Fatalf("expecting %s, got %s", want, got)
}
}