-
Notifications
You must be signed in to change notification settings - Fork 39
/
pagination_test.go
28 lines (20 loc) · 994 Bytes
/
pagination_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
package sentry
import (
"testing"
)
func TestLinkPagination(t *testing.T) {
examplelink := `<https://sentry.io/api/0/projects/the-interstellar-jurisdiction/pump-station/releases/?&cursor=100:-1:1>; rel="previous"; results="true"; cursor="100:-1:1", <https://sentry.io/api/0/projects/the-interstellar-jurisdiction/pump-station/releases/?&cursor=100:1:0>; rel="next"; results="true"; cursor="100:1:0`
link := NewLink(examplelink)
if link.Next.URL != "https://sentry.io/api/0/projects/the-interstellar-jurisdiction/pump-station/releases/?&cursor=100:1:0" {
t.Errorf("Link next isnt correct: %s", link.Next.URL)
}
if link.Previous.URL != "https://sentry.io/api/0/projects/the-interstellar-jurisdiction/pump-station/releases/?&cursor=100:-1:1" {
t.Errorf("Link previous isnt correct: %s", link.Previous.URL)
}
if !link.Next.Results {
t.Error("Results should be set to true for next")
}
if !link.Previous.Results {
t.Error("Results should be set to true for previous")
}
}