Skip to content

Commit 6dc3f2f

Browse files
committed
fix: default open behavior
1 parent 9b6d78b commit 6dc3f2f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/commands/force/org/open.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export class OrgOpenCommand extends SfdxCommand {
2222
path: flags.string({
2323
char: 'p',
2424
description: messages.getMessage('cliPath'),
25-
default: '%2Flightning%2Fsetup',
2625
env: 'FORCE_OPEN_URL',
2726
parse: (input) => encodeURIComponent(decodeURIComponent(input)),
2827
}),
@@ -34,7 +33,7 @@ export class OrgOpenCommand extends SfdxCommand {
3433

3534
public async run(): Promise<OrgOpenOutput> {
3635
const frontDoorUrl = await this.buildFrontdoorUrl();
37-
const url = `${frontDoorUrl}&retURL=${this.flags.path as string}`;
36+
const url = this.flags.path ? `${frontDoorUrl}&retURL=${this.flags.path as string}` : frontDoorUrl;
3837
const orgId = this.org.getOrgId();
3938
const username = this.org.getUsername();
4039
const output = { orgId, url, username };

test/commands/force/org/open.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const username = '[email protected]';
1717
const testPath = '/lightning/whatever';
1818
const testInstance = 'https://cs1.my.salesforce.com';
1919
const accessToken = 'testAccessToken';
20-
21-
const expectedUrl = `${testInstance}/secur/frontdoor.jsp?sid=${accessToken}&retURL=${encodeURIComponent(testPath)}`;
20+
const expectedDefaultUrl = `${testInstance}/secur/frontdoor.jsp?sid=${accessToken}`;
21+
const expectedUrl = `${expectedDefaultUrl}&retURL=${encodeURIComponent(testPath)}`;
2222

2323
const testJsonStructure = (response: object) => {
2424
expect(response).to.have.property('url');
@@ -52,9 +52,7 @@ describe('open commands', () => {
5252
const response = JSON.parse(ctx.stdout);
5353
expect(response.status).to.equal(0);
5454
expect(testJsonStructure(response.result)).to.be.true;
55-
expect(response.result.url).to.equal(
56-
`${testInstance}/secur/frontdoor.jsp?sid=${accessToken}&retURL=${encodeURIComponent('/lightning/setup')}`
57-
);
55+
expect(response.result.url).to.equal(expectedDefaultUrl);
5856
});
5957

6058
test

0 commit comments

Comments
 (0)