Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 5 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@oclif/plugin-not-found": "^3.2.73",
"@oclif/plugin-update": "3.2.4",
"@oclif/plugin-version": "^2.2.36",
"@oclif/table": "^0.5.8",
"@oclif/table": "0.5.4",
Comment thread
antusus marked this conversation as resolved.
"@octokit/rest": "^22.0.0",
"archiver": "^8.0.0",
"box-node-sdk": "^4.11.1",
Expand Down
1 change: 1 addition & 0 deletions src/commands/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ OAuthLoginCommand.flags = {

module.exports = OAuthLoginCommand;
module.exports._test = {
SUPPORTED_DEFAULT_APP_PORTS,
promptForAuthMethod,
promptForPlatformAppCredentials,
setOAuthCallbackTimeoutMs(timeoutMs) {
Expand Down
8 changes: 5 additions & 3 deletions src/commands/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ const UpdateCommand =

class GithubUpdatecommand extends UpdateCommand {
async run() {
const { printTable } = await import('@oclif/table');
const { flags } = await this.parse(UpdateCommand);
const { flags } = await this.parse(GithubUpdatecommand);
const updater = new GitHubUpdater(this.config);
if (flags.available) {
// @oclif/table is pinned to 0.5.4: later versions depend on string-width@8,
// which requires Node 20 and fails to load on Node 18.
const { printTable } = await import('@oclif/table');
const index = await updater.fetchVersionIndex();
const allVersions = sort(Object.keys(index)).reverse();
const localVersions = await updater.findLocalVersions();
Expand All @@ -30,7 +32,7 @@ class GithubUpdatecommand extends UpdateCommand {
return;
}

updater.runUpdate({
await updater.runUpdate({
autoUpdate: flags.autoupdate,
force: flags.force,
version: flags.interactive
Expand Down
41 changes: 18 additions & 23 deletions test/commands/configure-environments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Configure environments masking', function () {
sandbox.restore();
});

it('configure:environments:get should not print raw client secrets', function () {
test.do(() => {
getEnvironmentsStub.resolves({
default: 'dev',
environments: {
Expand All @@ -40,18 +40,18 @@ describe('Configure environments masking', function () {
},
},
});

return test
.stub(BoxCommand.prototype, 'getEnvironments', getEnvironmentsStub)
.stdout()
.command(['configure:environments:get'])
.it('masks clientSecret in output', (ctx) => {
})
.stdout()
.command(['configure:environments:get'])
.it(
'configure:environments:get should not print raw client secrets',
(ctx) => {
assert.notInclude(ctx.stdout, RAW_SECRET);
assert.include(ctx.stdout, MASKED_SECRET);
});
});
}
);

it('configure:environments:update should not print raw client secrets', function () {
test.do(() => {
getEnvironmentsStub.resolves({
default: 'dev',
environments: {
Expand All @@ -61,19 +61,14 @@ describe('Configure environments masking', function () {
},
},
});

return test
.stub(BoxCommand.prototype, 'getEnvironments', getEnvironmentsStub)
.stub(
BoxCommand.prototype,
'updateEnvironments',
updateEnvironmentsStub
)
.stdout()
.command(['configure:environments:update'])
.it('masks clientSecret in output', (ctx) => {
})
.stdout()
.command(['configure:environments:update'])
.it(
'configure:environments:update should not print raw client secrets',
(ctx) => {
assert.notInclude(ctx.stdout, RAW_SECRET);
assert.include(ctx.stdout, MASKED_SECRET);
});
});
}
);
});
52 changes: 27 additions & 25 deletions test/commands/hubs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,22 +421,23 @@ describe('Hubs', function () {
assert.deepEqual(JSON.parse(context.stdout), response);
});

it('rejects unsupported hub collaboration roles on create', async function () {
return test
.command([
'hubs:collaborations:create',
'12345',
'--role=owner',
'--user-id=22222',
'--token=test',
])
.catch((error) => {
test.stderr()
.command([
'hubs:collaborations:create',
'12345',
'--role=owner',
'--user-id=22222',
'--token=test',
])
.it(
'rejects unsupported hub collaboration roles on create',
(context) => {
assert.include(
error.message,
context.stderr,
'Expected --role=owner to be one of: editor, viewer, co-owner'
);
});
});
}
);
});

describe('hubs:collaborations:get', function () {
Expand Down Expand Up @@ -483,21 +484,22 @@ describe('Hubs', function () {
assert.deepEqual(JSON.parse(context.stdout), response);
});

it('rejects unsupported hub collaboration roles on update', async function () {
return test
.command([
'hubs:collaborations:update',
'99999',
'--role=owner',
'--token=test',
])
.catch((error) => {
test.stderr()
.command([
'hubs:collaborations:update',
'99999',
'--role=owner',
'--token=test',
])
.it(
'rejects unsupported hub collaboration roles on update',
(context) => {
assert.include(
error.message,
context.stderr,
'Expected --role=owner to be one of: editor, viewer, co-owner'
);
});
});
}
);
});

describe('hubs:collaborations:delete', function () {
Expand Down
Loading
Loading