• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

box / boxcli / 13208717992

07 Feb 2025 09:59PM UTC coverage: 84.603% (-0.7%) from 85.332%
13208717992

Pull #564

github

web-flow
Merge e5bbcd2b6 into 3d3b19f65
Pull Request #564: feat: add real API integration tests for users

1192 of 1607 branches covered (74.18%)

Branch coverage included in aggregate %.

4374 of 4972 relevant lines covered (87.97%)

374.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/src/pagination-utils.js
1
'use strict';
2

3
const { Flags } = require('@oclif/core');
9✔
4

5
const MAX_LIMIT = 1000;
9✔
6

7
/**
8
 * Sets correct limit option based on max-items flag.
9
 * If max-items is not present limit is set to 1000
10
 *
11
 * @param {Object} commandFlags Flags from the command
12
 * @returns {Object} Options for http request
13
 * @private
14
 *
15
 **/
16
function parsePaginationFlags(commandFlags) {
17
        let limitFlag =
18
                commandFlags['max-items'] === undefined
1,098✔
19
                        ? MAX_LIMIT
20
                        : commandFlags['max-items'];
21

22
        if (limitFlag <= 0) {
1,098!
23
                throw new Error('Max items must be greater than 0');
×
24
        }
25

26
        let options = { limit: Math.min(MAX_LIMIT, limitFlag) };
1,098✔
27

28
        return options;
1,098✔
29
}
30

31
module.exports = {
9✔
32
        forceMarkerPagination(commandFlags) {
33
                let options = parsePaginationFlags(commandFlags);
135✔
34
                options.usemarker = true;
135✔
35

36
                return options;
135✔
37
        },
38

39
        handlePagination(commandFlags) {
40
                return parsePaginationFlags(commandFlags);
963✔
41
        },
42
};
43

44
module.exports.flags = Object.freeze({
9✔
45
        'max-items': Flags.integer({
46
                description:
47
                        'A value that indicates the maximum number of results to return. This only specifies a maximum boundary and will not guarantee the minimum number of results returned. When the max-items (x) is greater than 1000, then the maximum ceil(x/1000) requests will be made.',
48
        }),
49
});
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc