-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_test.go
More file actions
47 lines (38 loc) · 751 Bytes
/
example_test.go
File metadata and controls
47 lines (38 loc) · 751 Bytes
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
//go:build ignore
package assert
import (
"testing"
"time"
"github.com/google/uuid"
"github.com/shopspring/decimal"
)
func ExampleEqual(t *testing.T) {
type User struct {
Id uuid.UUID
Email string
CreatedAt time.Time
Balance decimal.Decimal
active bool
}
loc, _ := time.LoadLocation("Europe/Warsaw")
// db.CreateUser("test@example.com")
createdAt := time.Now()
user := User{
Id: uuid.New(),
Email: "test@example.com",
CreatedAt: createdAt,
Balance: decimal.NewFromFloat(1),
active: true,
}
Equal(
t,
user,
User{
Email: "test@example.com",
CreatedAt: createdAt.In(loc),
Balance: decimal.RequireFromString("1"),
},
IgnoreUnexported(),
SkipEmptyFields(),
)
}