Skip to content

Commit 88db5d8

Browse files
author
NarrowsProjects
committed
chore removed unneeded length checks from should successfully filter by rootOnly
1 parent 4fa1173 commit 88db5d8

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

test/api/logs.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,14 +288,14 @@ module.exports = () => {
288288
expect(unfilteredResponse.status).to.equal(200);
289289

290290
// When a log has no rootLogId the logs adapter will set the row itself as the root log
291-
let rootLogs = unfilteredResponse.body.data.filter(({ rootLogId, id }) => rootLogId === id);
292-
293-
expect(rootLogs).to.lengthOf(8); // limit = 10; 10-2 = 8
291+
let hasChildLogs = unfilteredResponse.body.data.some(({ rootLogId, id }) => rootLogId !== id);
292+
expect(hasChildLogs).to.be.true;
294293

295294
const filteredResponse = await request(server).get('/api/logs?page[offset]=0&page[limit]=10&filter[rootOnly]=true');
296295
expect(filteredResponse.status).to.equal(200);
297-
rootLogs = filteredResponse.body.data.filter(({ rootLogId, id }) => rootLogId === id);
298-
expect(rootLogs).to.lengthOf(10); // all of the child data has now been excluded
296+
297+
hasChildLogs = filteredResponse.body.data.every(({ rootLogId, id }) => rootLogId !== id);
298+
expect(hasChildLogs).to.be.false;
299299
})
300300

301301
it('should successfully ignore rootOnly filters if rootLog is provided', async () => {

0 commit comments

Comments
 (0)