Fix Pagination variable from *int64 to int64
This commit is contained in:
parent
1c0e37928e
commit
f283f05671
5 changed files with 35 additions and 46 deletions
|
@ -25,26 +25,26 @@ func TestDoAPI(t *testing.T) {
|
|||
c := NewClient(&Config{Server: ts.URL})
|
||||
var accounts []Account
|
||||
err := c.doAPI(context.Background(), http.MethodGet, "/", nil, &accounts, &Pagination{
|
||||
MaxID: Int64(999),
|
||||
MaxID: 999,
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
|
||||
pg := &Pagination{
|
||||
MaxID: Int64(123),
|
||||
SinceID: Int64(789),
|
||||
Limit: Int64(10),
|
||||
MaxID: 123,
|
||||
SinceID: 789,
|
||||
Limit: 10,
|
||||
}
|
||||
err = c.doAPI(context.Background(), http.MethodGet, "/", url.Values{}, &accounts, pg)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
if *pg.MaxID != 234 {
|
||||
t.Fatalf("want %d but %d", 234, *pg.MaxID)
|
||||
if pg.MaxID != 234 {
|
||||
t.Fatalf("want %d but %d", 234, pg.MaxID)
|
||||
}
|
||||
if *pg.SinceID != 890 {
|
||||
t.Fatalf("want %d but %d", 890, *pg.SinceID)
|
||||
if pg.SinceID != 890 {
|
||||
t.Fatalf("want %d but %d", 890, pg.SinceID)
|
||||
}
|
||||
if accounts[0].Username != "foo" {
|
||||
t.Fatalf("want %q but %q", "foo", accounts[0].Username)
|
||||
|
@ -54,19 +54,19 @@ func TestDoAPI(t *testing.T) {
|
|||
}
|
||||
|
||||
pg = &Pagination{
|
||||
MaxID: Int64(123),
|
||||
SinceID: Int64(789),
|
||||
Limit: Int64(10),
|
||||
MaxID: 123,
|
||||
SinceID: 789,
|
||||
Limit: 10,
|
||||
}
|
||||
err = c.doAPI(context.Background(), http.MethodGet, "/", nil, &accounts, pg)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
if *pg.MaxID != 234 {
|
||||
t.Fatalf("want %d but %d", 234, *pg.MaxID)
|
||||
if pg.MaxID != 234 {
|
||||
t.Fatalf("want %d but %d", 234, pg.MaxID)
|
||||
}
|
||||
if *pg.SinceID != 890 {
|
||||
t.Fatalf("want %d but %d", 890, *pg.SinceID)
|
||||
if pg.SinceID != 890 {
|
||||
t.Fatalf("want %d but %d", 890, pg.SinceID)
|
||||
}
|
||||
if accounts[0].Username != "foo" {
|
||||
t.Fatalf("want %q but %q", "foo", accounts[0].Username)
|
||||
|
@ -297,11 +297,11 @@ func TestNewPagination(t *testing.T) {
|
|||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
if *pg.MaxID != 123 {
|
||||
t.Fatalf("want %d but %d", 123, *pg.MaxID)
|
||||
if pg.MaxID != 123 {
|
||||
t.Fatalf("want %d but %d", 123, pg.MaxID)
|
||||
}
|
||||
if *pg.SinceID != 789 {
|
||||
t.Fatalf("want %d but %d", 789, *pg.SinceID)
|
||||
if pg.SinceID != 789 {
|
||||
t.Fatalf("want %d but %d", 789, pg.SinceID)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,9 +327,9 @@ func TestGetPaginationID(t *testing.T) {
|
|||
|
||||
func TestPaginationSetValues(t *testing.T) {
|
||||
p := &Pagination{
|
||||
MaxID: Int64(123),
|
||||
SinceID: Int64(789),
|
||||
Limit: Int64(10),
|
||||
MaxID: 123,
|
||||
SinceID: 789,
|
||||
Limit: 10,
|
||||
}
|
||||
before := url.Values{"key": {"value"}}
|
||||
after := p.setValues(before)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue