// Copyright 2023 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. package gitea import ( "net/http" "strings" "testing" "github.com/stretchr/testify/assert" ) func TestParsedPaging(t *testing.T) { resp := newResponse(&http.Response{ Header: http.Header{ "Link": []string{ strings.Join( []string{ `; rel="next"`, `; rel="last"`, `; rel="first"`, `; rel="prev"`, }, ",", ), }, }, }) assert.Equal(t, 1, resp.FirstPage) assert.Equal(t, 1, resp.PrevPage) assert.Equal(t, 3, resp.NextPage) assert.Equal(t, 4, resp.LastPage) }