generated from salesforcecli/plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added setpassedusernameunique flag #827
- Loading branch information
1 parent
7ff1637
commit 2e28714
Showing
4 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,4 +354,80 @@ describe('force:user:create', () => { | |
'The username "[email protected]" already exists in this or another Salesforce org. Usernames must be unique across all Salesforce orgs.' | ||
); | ||
}); | ||
|
||
test | ||
.do(async () => { | ||
await prepareStubs({}, false); | ||
}) | ||
.stdout() | ||
.command([ | ||
'force:user:create', | ||
'--json', | ||
'--targetusername', | ||
'[email protected]', | ||
'--targetdevhubusername', | ||
'[email protected]', | ||
'[email protected]', | ||
'--setpassedusernameunique', | ||
]) | ||
.it('will append the org id to the passed username if the setpassedusernameunique is used', (ctx) => { | ||
const expected = { | ||
orgId: 'abc123', | ||
permissionSetAssignments: [], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailencodingkey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languagelocalekey: 'en_US', | ||
lastname: 'User', | ||
localesidkey: 'en_US', | ||
profileid: '00e2D000000bNexWWR', | ||
timezonesidkey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
expect(authInfoStub.callCount).to.be.equal(0); | ||
}); | ||
|
||
test | ||
.do(async () => { | ||
await prepareStubs({}, false); | ||
}) | ||
.stdout() | ||
.command([ | ||
'force:user:create', | ||
'--json', | ||
'--targetusername', | ||
'[email protected]', | ||
'--targetdevhubusername', | ||
'[email protected]', | ||
'--setpassedusernameunique', | ||
]) | ||
.it( | ||
'will not append the org id to the username if the setpassedusernameunique is used but username was generated by the CLI', | ||
(ctx) => { | ||
const expected = { | ||
orgId: 'abc123', | ||
permissionSetAssignments: [], | ||
fields: { | ||
alias: 'testAlias', | ||
email: '[email protected]', | ||
emailencodingkey: 'UTF-8', | ||
id: '0052D0000043PawWWR', | ||
languagelocalekey: 'en_US', | ||
lastname: 'User', | ||
localesidkey: 'en_US', | ||
profileid: '00e2D000000bNexWWR', | ||
timezonesidkey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
}; | ||
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
expect(authInfoStub.callCount).to.be.equal(0); | ||
} | ||
); | ||
}); |