Skip to content

Commit 525fbaa

Browse files
committed
chore: use basic function
1 parent 0b1860f commit 525fbaa

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ export class Create extends SfdxCommand {
263263

264264
private async setAliasAndDefaultUsername(username: string): Promise<void> {
265265
if (this.flags.setalias) {
266-
await Aliases.parseAndUpdate([`${this.flags.setalias as string}=${username}`]);
266+
const alias = await Aliases.create(Aliases.getDefaultOptions());
267+
await alias.updateValue(this.flags.setalias, username);
267268
this.logger.debug('Set Alias: %s result: %s', this.flags.setalias);
268269
}
269270
if (this.flags.setdefaultusername) {

test/commands/force/org/scratchOrgCreate.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ describe('org:create', () => {
198198
...CREATE_RESULT,
199199
username: 'newScratchUsername',
200200
});
201-
const aliasStub = stubMethod(sandbox, Aliases, 'parseAndUpdate');
201+
const aliasStub = stubMethod(sandbox, Aliases.prototype, 'updateValue');
202202
const configStub = stubMethod(sandbox, Config.prototype, 'set');
203203
await command.runIt();
204204
expect(prodOrg.firstCall.args[0]).to.deep.equal({
@@ -216,7 +216,7 @@ describe('org:create', () => {
216216
retry: 0,
217217
orgConfig: {},
218218
});
219-
expect(aliasStub.firstCall.args).to.deep.equal([['scratchOrgAlias=newScratchUsername']]);
219+
expect(aliasStub.firstCall.args).to.deep.equal(['scratchOrgAlias', 'newScratchUsername']);
220220
expect(configStub.firstCall.args).to.deep.equal(['defaultusername', 'newScratchUsername']);
221221
});
222222

0 commit comments

Comments
 (0)