Skip to content

Commit 71bb2cd

Browse files
committed
chore: do not use deprecated config vars [sb-nuts]
1 parent 226e9a5 commit 71bb2cd

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

src/commands/force/org/beta/create.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
SandboxRequest,
2525
SandboxUserAuthResponse,
2626
SfError,
27-
SfdxPropertyKeys,
2827
StatusEvent,
2928
ScratchOrgRequest,
3029
ScratchOrgInfo,
@@ -215,7 +214,7 @@ export class Create extends SfdxCommand {
215214
}
216215
if (this.flags.setdefaultusername) {
217216
const globalConfig: Config = this.configAggregator.getGlobalConfig();
218-
globalConfig.set(SfdxPropertyKeys.DEFAULT_USERNAME, results.sandboxRes.authUserName);
217+
globalConfig.set(OrgConfigProperties.TARGET_ORG, results.sandboxRes.authUserName);
219218
const result = await globalConfig.write();
220219
this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
221220
}
@@ -242,7 +241,7 @@ export class Create extends SfdxCommand {
242241
}
243242
if (this.flags.setdefaultusername && this.sandboxAuth) {
244243
const globalConfig: Config = this.configAggregator.getGlobalConfig();
245-
globalConfig.set(SfdxPropertyKeys.DEFAULT_USERNAME, this.sandboxAuth.authUserName);
244+
globalConfig.set(OrgConfigProperties.TARGET_ORG, this.sandboxAuth.authUserName);
246245
const result = await globalConfig.write();
247246
this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
248247
}

src/commands/force/org/clone.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
Lifecycle,
1515
Messages,
1616
OrgTypes,
17-
SfdxPropertyKeys,
17+
OrgConfigProperties,
1818
StateAggregator,
1919
SandboxEvents,
2020
SandboxRequest,
@@ -96,7 +96,7 @@ export class OrgCloneCommand extends SfdxCommand {
9696
}
9797
if (this.flags.setdefaultusername) {
9898
const globalConfig: Config = this.configAggregator.getGlobalConfig();
99-
globalConfig.set(SfdxPropertyKeys.DEFAULT_USERNAME, results.sandboxRes.authUserName);
99+
globalConfig.set(OrgConfigProperties.TARGET_ORG, results.sandboxRes.authUserName);
100100
const result = await globalConfig.write();
101101
this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
102102
}

src/commands/force/org/status.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
Messages,
1414
StateAggregator,
1515
SandboxEvents,
16-
SfdxPropertyKeys,
16+
OrgConfigProperties,
1717
StatusEvent,
1818
ResultEvent,
1919
SandboxProcessObject,
@@ -78,7 +78,7 @@ export class OrgStatusCommand extends SfdxCommand {
7878
}
7979
if (this.flags.setdefaultusername) {
8080
const globalConfig: Config = this.configAggregator.getGlobalConfig();
81-
globalConfig.set(SfdxPropertyKeys.DEFAULT_USERNAME, results.sandboxRes.authUserName);
81+
globalConfig.set(OrgConfigProperties.TARGET_ORG, results.sandboxRes.authUserName);
8282
const result = await globalConfig.write();
8383
this.logger.debug('Set defaultUsername: %s result: %s', this.flags.setdefaultusername, result);
8484
}

test/commands/force/org/clone.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
StateAggregator,
1111
SandboxEvents,
1212
SfdxConfigAggregator,
13-
SfdxPropertyKeys,
13+
OrgConfigProperties,
1414
} from '@salesforce/core';
1515
import { fromStub, stubInterface, stubMethod } from '@salesforce/ts-sinon';
1616
import * as sinon from 'sinon';
@@ -217,7 +217,7 @@ describe('org:clone', () => {
217217
expect(aliasSetStub.callCount).to.be.equal(1);
218218
expect(aliasSetStub.firstCall.args[0]).to.be.equal(sandboxalias);
219219
expect(aliasSetStub.firstCall.args[1]).to.be.equal(authUserName);
220-
expect(configSetStub.firstCall.args[0]).to.be.equal(SfdxPropertyKeys.DEFAULT_USERNAME);
220+
expect(configSetStub.firstCall.args[0]).to.be.equal(OrgConfigProperties.TARGET_ORG);
221221
expect(configSetStub.firstCall.args[1]).to.be.equal(authUserName);
222222
expect(onStub.firstCall.firstArg).to.be.equal(SandboxEvents.EVENT_ASYNC_RESULT);
223223
expect(onStub.secondCall.firstArg).to.be.equal(SandboxEvents.EVENT_STATUS);

test/commands/force/org/sandboxCreate.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ describe('org:create', () => {
336336
},
337337
]);
338338
expect(aliasSetStub.firstCall.args).to.deep.equal(['sandboxAlias', 'newSandboxUsername']);
339-
expect(configStub.firstCall.args).to.deep.equal(['defaultusername', 'newSandboxUsername']);
339+
expect(configStub.firstCall.args).to.deep.equal(['target-org', 'newSandboxUsername']);
340340
});
341341

342342
const sandboxRes: SandboxUserAuthResponse = {

test/commands/force/org/status.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import {
99
Org,
10-
SfdxPropertyKeys,
10+
OrgConfigProperties,
1111
SfdxConfigAggregator,
1212
StateAggregator,
1313
ConfigAggregator,
@@ -139,7 +139,7 @@ describe('org:status', () => {
139139

140140
it('will set default username', async () => {
141141
const res = await runStatusCommand(['--sandboxname', sanboxname, '--setdefaultusername']);
142-
expect(configSetStub.firstCall.args[0]).to.be.equal(SfdxPropertyKeys.DEFAULT_USERNAME);
142+
expect(configSetStub.firstCall.args[0]).to.be.equal(OrgConfigProperties.TARGET_ORG);
143143
expect(configSetStub.firstCall.args[1]).to.be.equal(authUserName);
144144
expect(configWriteStub.calledOnce).to.be.true;
145145
expect(onStub.secondCall.firstArg).to.be.equal(SandboxEvents.EVENT_RESULT);

0 commit comments

Comments
 (0)