MCPcopy Index your code
hub / github.com/google/go-github / TestResponse_SinceWithPage

Function TestResponse_SinceWithPage

github/github_test.go:1977–2006  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1975}
1976
1977func TestResponse_SinceWithPage(t *testing.T) {
1978 t.Parallel()
1979 r := http.Response{
1980 Header: http.Header{
1981 "Link": {
1982 `<https://api.github.com/?since=2021-12-04T10%3A43%3A42Z&page=1>; rel="first",` +
1983 ` <https://api.github.com/?since=2021-12-04T10%3A43%3A42Z&page=2>; rel="prev",` +
1984 ` <https://api.github.com/?since=2021-12-04T10%3A43%3A42Z&page=4>; rel="next",` +
1985 ` <https://api.github.com/?since=2021-12-04T10%3A43%3A42Z&page=5>; rel="last"`,
1986 },
1987 },
1988 }
1989
1990 response := newResponse(&r)
1991 if got, want := response.FirstPage, 1; got != want {
1992 t.Errorf("response.FirstPage: %v, want %v", got, want)
1993 }
1994 if got, want := response.PrevPage, 2; want != got {
1995 t.Errorf("response.PrevPage: %v, want %v", got, want)
1996 }
1997 if got, want := response.NextPage, 4; want != got {
1998 t.Errorf("response.NextPage: %v, want %v", got, want)
1999 }
2000 if got, want := response.LastPage, 5; want != got {
2001 t.Errorf("response.LastPage: %v, want %v", got, want)
2002 }
2003 if got, want := response.NextPageToken, ""; want != got {
2004 t.Errorf("response.NextPageToken: %v, want %v", got, want)
2005 }
2006}
2007
2008func TestResponse_cursorPagination(t *testing.T) {
2009 t.Parallel()

Callers

nothing calls this directly

Calls 1

newResponseFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…