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.
fix: remove ProfileId query when we only need User Id
- Loading branch information
1 parent
6f07bca
commit a81c46c
Showing
2 changed files
with
21 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ describe('force:user:password:generate', () => { | |
let authInfoStub: StubbedType<AuthInfo>; | ||
let authInfoConfigStub: StubbedType<AuthInfoConfig>; | ||
const testData = new MockTestOrgData(); | ||
let queryStub; | ||
|
||
async function prepareStubs(throws = false) { | ||
const authFields = await testData.getConfig(); | ||
|
@@ -31,8 +32,12 @@ describe('force:user:password:generate', () => { | |
stubMethod($$.SANDBOX, Org, 'create').callsFake(async () => Org.prototype); | ||
stubMethod($$.SANDBOX, Org.prototype, 'getUsername').returns('[email protected]'); | ||
stubMethod($$.SANDBOX, User, 'create').callsFake(async () => User.prototype); | ||
stubMethod($$.SANDBOX, User.prototype, 'retrieve').resolves({ | ||
id: '0052D0000043PawWWR', | ||
queryStub = stubMethod($$.SANDBOX, Connection.prototype, 'query').resolves({ | ||
records: [ | ||
{ | ||
Id: '0052D0000043PawWWR', | ||
}, | ||
], | ||
}); | ||
|
||
const secureBuffer: SecureBuffer<void> = new SecureBuffer<void>(); | ||
|
@@ -68,6 +73,7 @@ describe('force:user:password:generate', () => { | |
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
expect(authInfoStub.update.callCount).to.equal(2); | ||
expect(queryStub.callCount).to.equal(2); | ||
}); | ||
|
||
test | ||
|
@@ -79,6 +85,7 @@ describe('force:user:password:generate', () => { | |
const result = JSON.parse(ctx.stdout).result; | ||
expect(result).to.deep.equal(expected); | ||
expect(authInfoStub.update.callCount).to.equal(1); | ||
expect(queryStub.callCount).to.equal(1); | ||
}); | ||
|
||
test | ||
|
@@ -92,5 +99,6 @@ describe('force:user:password:generate', () => { | |
expect(result.status).to.equal(1); | ||
expect(result.name).to.equal('noSelfSetError'); | ||
expect(authInfoStub.update.callCount).to.equal(0); | ||
expect(queryStub.callCount).to.equal(1); | ||
}); | ||
}); |