Skip to content

Commit 02d7f53

Browse files
committed
[O2B-1544] Use flatMap to aggregate environment IDs
This improves readability and extensibility.
1 parent 4f52a56 commit 02d7f53

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

test/lib/usecases/environment/GetAllEnvironmentsUseCase.test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,7 @@ module.exports = () => {
255255
expect(page3.environments.length).to.be.equal(limit);
256256

257257
// Collect all environment IDs and verify no duplicates and all present
258-
const allIds = [
259-
...page1.environments.map(({ id }) => id),
260-
...page2.environments.map(({ id }) => id),
261-
...page3.environments.map(({ id }) => id),
262-
];
258+
const allIds = [page1, page2, page3].flatMap(({ environments })=> environments.map(({ id }) => id));
263259

264260
expect(allIds.length).to.be.equal(totalMatchingFilter);
265261
expect(new Set(allIds).size).to.be.equal(totalMatchingFilter);

0 commit comments

Comments
 (0)