Skip to content

can hasPreviousPage and hasNextPage both be true? #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MattMcFarland opened this issue Dec 23, 2015 · 1 comment
Closed

can hasPreviousPage and hasNextPage both be true? #55

MattMcFarland opened this issue Dec 23, 2015 · 1 comment

Comments

@MattMcFarland
Copy link

Looking at this test case:

describe('pagination', () => {
it('respects first and after', () => {
var c = connectionFromArray(
letters,
{first: 2, after: 'YXJyYXljb25uZWN0aW9uOjE='}
);
return expect(c).to.deep.equal({
edges: [
{
node: 'C',
cursor: 'YXJyYXljb25uZWN0aW9uOjI=',
},
{
node: 'D',
cursor: 'YXJyYXljb25uZWN0aW9uOjM=',
},
],
pageInfo: {
startCursor: 'YXJyYXljb25uZWN0aW9uOjI=',
endCursor: 'YXJyYXljb25uZWN0aW9uOjM=',
hasPreviousPage: false,
hasNextPage: true,
}
});
});

  describe('pagination', () => {
    it('respects first and after', () => {
      var c = connectionFromArray(
        letters,
        {first: 2, after: 'YXJyYXljb25uZWN0aW9uOjE='}
      );
      return expect(c).to.deep.equal({
        edges: [
          {
            node: 'C',
            cursor: 'YXJyYXljb25uZWN0aW9uOjI=',
          },
          {
            node: 'D',
            cursor: 'YXJyYXljb25uZWN0aW9uOjM=',
          },
        ],
        pageInfo: {
          startCursor: 'YXJyYXljb25uZWN0aW9uOjI=',
          endCursor: 'YXJyYXljb25uZWN0aW9uOjM=',
          hasPreviousPage: false,
          hasNextPage: true,
        }
      });
    });

Because there is also an A and a B - shouldn't hasPreviousPage be true? If not, then how do we know there is a previous page available??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant