Skip to content

Commit

Permalink
Refactor pagination tests to await loops
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilianoBruni committed Feb 8, 2024
1 parent 143baa9 commit 38fdf3c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/060-pagination.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ t.test('Check pagination without filters', async t => {
t.equal(res.json().items.at(-1).id, 2);
});

['offset', 'skip'].forEach(param => {
for await (const param of ['offset', 'skip']) {
t.test(`Limit the number of items and ${param} some`, async t => {
const res = await app.inject({
method: 'GET',
Expand All @@ -77,8 +77,9 @@ t.test('Check pagination without filters', async t => {
// first record has id == 3
t.equal(res.json().items[0].id, 3);
});
});
[('page', 'window')].forEach(param => {
};

for await (const param of ['page', 'window']) {
t.test(`Limit the number of items and get first ${param}`, async t => {
const res = await app.inject({
method: 'GET',
Expand Down Expand Up @@ -107,7 +108,7 @@ t.test('Check pagination without filters', async t => {
t.equal(res.json().items[0].id, 3);
}
);
});
};
});

t.test('Check pagination with filters', async t => {
Expand Down

0 comments on commit 38fdf3c

Please sign in to comment.