changed last-id behaviour to from-id
This commit is contained in:
@ -113,16 +113,16 @@ describe('/sample', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns results starting after last-id', done => {
|
||||
it('returns results starting from first-id', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'get',
|
||||
url: '/samples?status=all&last-id=400000000000000000000002',
|
||||
url: '/samples?status=all&from-id=400000000000000000000002',
|
||||
auth: {basic: 'janedoe'},
|
||||
httpStatus: 200
|
||||
}).end((err, res) => {
|
||||
if (err) return done(err);
|
||||
should(res.body[0]).have.property('_id', '400000000000000000000003');
|
||||
should(res.body[1]).have.property('_id', '400000000000000000000004');
|
||||
should(res.body[0]).have.property('_id', '400000000000000000000002');
|
||||
should(res.body[1]).have.property('_id', '400000000000000000000003');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -141,13 +141,13 @@ describe('/sample', () => {
|
||||
it('works with negative page numbers', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'get',
|
||||
url: '/samples?status=all&to-page=-1&page-size=2&last-id=400000000000000000000004',
|
||||
url: '/samples?status=all&to-page=-1&page-size=2&from-id=400000000000000000000004',
|
||||
auth: {basic: 'janedoe'},
|
||||
httpStatus: 200
|
||||
}).end((err, res) => {
|
||||
if (err) return done(err);
|
||||
should(res.body[0]).have.property('_id', '400000000000000000000001');
|
||||
should(res.body[1]).have.property('_id', '400000000000000000000002');
|
||||
should(res.body[0]).have.property('_id', '400000000000000000000002');
|
||||
should(res.body[1]).have.property('_id', '400000000000000000000003');
|
||||
done();
|
||||
});
|
||||
});
|
||||
@ -167,7 +167,7 @@ describe('/sample', () => {
|
||||
it('returns an empty array for a page number out of negative range', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'get',
|
||||
url: '/samples?status=all&to-page=-100&page-size=3&last-id=400000000000000000000004',
|
||||
url: '/samples?status=all&to-page=-100&page-size=3&from-id=400000000000000000000004',
|
||||
auth: {basic: 'janedoe'},
|
||||
httpStatus: 200
|
||||
}).end((err, res) => {
|
||||
@ -186,13 +186,13 @@ describe('/sample', () => {
|
||||
res: {status: 'Invalid body format', details: '"page-size" must be larger than or equal to 1'}
|
||||
});
|
||||
});
|
||||
it('rejects an invalid last-id', done => {
|
||||
it('rejects an invalid from-id', done => {
|
||||
TestHelper.request(server, done, {
|
||||
method: 'get',
|
||||
url: '/samples?last-id=40000000000h000000000002',
|
||||
url: '/samples?from-id=40000000000h000000000002',
|
||||
auth: {basic: 'janedoe'},
|
||||
httpStatus: 400,
|
||||
res: {status: 'Invalid body format', details: '"last-id" with value "40000000000h000000000002" fails to match the required pattern: /[0-9a-f]{24}/'}
|
||||
res: {status: 'Invalid body format', details: '"from-id" with value "40000000000h000000000002" fails to match the required pattern: /[0-9a-f]{24}/'}
|
||||
});
|
||||
});
|
||||
it('rejects a to-page without page-size', done => {
|
||||
|
Reference in New Issue
Block a user