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

box / boxcli / 3688883245

pending completion
3688883245

Pull #441

github

GitHub
Merge 0c6f2cfe0 into 83ac6d7c8
Pull Request #441: fix: single file upload on Node 16

1077 of 1387 branches covered (77.65%)

Branch coverage included in aggregate %.

35 of 54 new or added lines in 9 files covered. (64.81%)

1 existing line in 1 file now uncovered.

3935 of 4421 relevant lines covered (89.01%)

121.05 hits per line

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

30.0
/src/commands/configure/environments/switch-user.js
1
'use strict';
2

3
const BoxCommand = require('../../../box-command');
3✔
4
const { flags } = require('@oclif/command');
3✔
5
const chalk = require('chalk');
3✔
6

7
class EnvironmentsSwitchUserCommand extends BoxCommand {
8
        async run() {
9
                const { flags, args } = this.parse(EnvironmentsSwitchUserCommand);
×
10

11
                let environmentsObj = await this.getEnvironments();
×
12
                let environment = environmentsObj.environments[environmentsObj.default];
×
13

14
                if (flags.default && !args.userID) {
×
15
                        environment.useDefaultAsUser = false;
×
16
                } else if (args.userID && !flags.default) {
×
17
                        environment.useDefaultAsUser = true;
×
18
                        environment.defaultAsUserId = args.userID;
×
19
                } else {
20
                        throw new Error('Either a userID argument or --default flag must be passed, but not both');
×
21
                }
22

23
                await this.updateEnvironments(environmentsObj);
×
24
                this.info(chalk`{green User set to ${args.userID || 'default'}}`);
×
25
        }
26
}
27

28
// @NOTE: This command does not require a client to be set up
29
EnvironmentsSwitchUserCommand.noClient = true;
3✔
30

31
EnvironmentsSwitchUserCommand.description = 'Switch the default Box user to run commands as';
3✔
32

33
EnvironmentsSwitchUserCommand.flags = {
3✔
34
        ...BoxCommand.minFlags,
35
};
36

37
EnvironmentsSwitchUserCommand.args = [
3✔
38
        {
39
                name: 'userID',
40
                hidden: false,
41
                required: false,
42
                description: 'The user ID to switch to'
43
        }
44
];
45

46
EnvironmentsSwitchUserCommand.flags = {
3✔
47
        ...BoxCommand.flags,
48
        default: flags.boolean({
49
                description: 'Switch to the default user, i.e. the Service Account'
50
        }),
51
};
52

53
module.exports = EnvironmentsSwitchUserCommand;
3✔
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

© 2025 Coveralls, Inc