-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #2693 PageCount doesn't work if the query gets constructed with p…
…age number as the first query parameter (#2911) Fix #2693 Co-authored-by: Keegan Campbell <[email protected]>
- Loading branch information
1 parent
110b4e3
commit a317340
Showing
2 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using Octokit.Models.Request.Enterprise; | ||
using Xunit; | ||
|
||
namespace Octokit.Tests.Http | ||
{ | ||
public class PaginationTests | ||
{ | ||
public class TheShouldContinueMethod | ||
{ | ||
[Fact] | ||
public void HandlesMissingUri() | ||
{ | ||
var result = Pagination.ShouldContinue(null, null); | ||
Assert.False(result); | ||
} | ||
|
||
[Fact] | ||
public void HandlesIsDone() | ||
{ | ||
var uri = new Uri("http://example.com"); | ||
var options = new ApiOptionsExtended { IsDone = true }; | ||
var result = Pagination.ShouldContinue(uri, options); | ||
Assert.False(result); | ||
} | ||
|
||
[Fact] | ||
public void HandlesPageCountPageFirstParam() | ||
{ | ||
var uri = new Uri("http://example.com?page=2"); | ||
var options = new ApiOptions { StartPage = 1, PageCount = 1 }; | ||
var result = Pagination.ShouldContinue(uri, options); | ||
Assert.False(result); | ||
} | ||
|
||
[Fact] | ||
public void HandlesPageCountPageNotFirstParam() | ||
{ | ||
var uri = new Uri("http://example.com?page_size=100&page=2"); | ||
var options = new ApiOptions { StartPage = 1, PageCount = 1 }; | ||
var result = Pagination.ShouldContinue(uri, options); | ||
Assert.False(result); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters