-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: devScripts update #646
Changes from 5 commits
c70733e
b03f875
5c8f919
c7aa4b8
908f4ef
c446f44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,21 +32,23 @@ describe('org:create:user', () => { | |
|
||
it('will properly merge fields regardless of capitalization', async () => { | ||
// notice the varied capitalization | ||
$$.SANDBOX.stub(fs.promises, 'readFile').resolves( | ||
JSON.stringify({ | ||
id: originalUserId, | ||
Username: '[email protected]', | ||
Alias: 'testAlias', | ||
Email: username, | ||
EmailEncodingKey: 'UTF-8', | ||
LanguageLocaleKey: 'en_US', | ||
localeSidKey: 'en_US', | ||
ProfileId: '00e2D000000bNexWWR', | ||
LastName: 'User', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
permsets: ['permset1', 'permset2'], | ||
}) | ||
); | ||
$$.SANDBOX.stub(fs.promises, 'readFile') | ||
.withArgs('testing') | ||
.resolves( | ||
JSON.stringify({ | ||
id: originalUserId, | ||
Username: '[email protected]', | ||
Alias: 'testAlias', | ||
Email: username, | ||
EmailEncodingKey: 'UTF-8', | ||
LanguageLocaleKey: 'en_US', | ||
localeSidKey: 'en_US', | ||
ProfileId: '00e2D000000bNexWWR', | ||
LastName: 'User', | ||
timeZoneSidKey: 'America/Los_Angeles', | ||
permsets: ['permset1', 'permset2'], | ||
}) | ||
); | ||
|
||
const createCommand = new CreateUserCommand(['-f', 'userConfig.json'], {} as Config); | ||
|
||
|
@@ -131,7 +133,15 @@ describe('org:create:user', () => { | |
if (readsFile) { | ||
$$.SANDBOXES.CONNECTION.stub(Connection.prototype, 'singleRecordQuery').resolves({ Id: '12345678' }); | ||
$$.SANDBOX.stub(Logger.prototype, 'debug'); | ||
$$.SANDBOX.stub(fs.promises, 'readFile').resolves(JSON.stringify(readsFile)); | ||
if (typeof readsFile !== 'boolean') { | ||
const fsStub = $$.SANDBOX.stub(fs.promises, 'readFile'); | ||
fsStub.withArgs('parent/child/file.json').resolves(JSON.stringify(readsFile)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. only changes readFile for the file it needs to stub. callThrough lets the original implementation work in other cases. |
||
fsStub.callThrough(); | ||
// $$.SANDBOX.stub(fs.promises, 'readFile') | ||
// .withArgs('parent/child/file.json') | ||
// .resolves(JSON.stringify(readsFile)) | ||
// .callThrough(); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -151,7 +161,7 @@ describe('org:create:user', () => { | |
localesidkey: 'en_US', | ||
generatepassword: true, | ||
profileid: '12345678', | ||
profilename: 'profileFromArgs', | ||
profilename: 'profileFromFile', | ||
timezonesidkey: 'America/Los_Angeles', | ||
username: '[email protected]', | ||
}, | ||
|
@@ -163,6 +173,8 @@ describe('org:create:user', () => { | |
testOrg.username, | ||
'--target-dev-hub', | ||
'[email protected]', | ||
'--definition-file', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test says it's testing override of file, but wasn't using the file contents. |
||
'parent/child/file.json', | ||
"permsets='permCLI, permCLI2'", | ||
'generatepassword=true', | ||
], | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only change readFile for the file you care about