-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check for functions on org before creating compute env (#41)
- Loading branch information
Showing
4 changed files
with
58 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 |
---|---|---|
|
@@ -9,6 +9,12 @@ const APP_MOCK = { | |
|
||
const USERNAME = '[email protected]' | ||
|
||
const CONN_MOCK = { | ||
metadata: { | ||
list: sinon.stub(), | ||
}, | ||
} | ||
|
||
const ORG_MOCK = { | ||
id: '1', | ||
getOrgId() { | ||
|
@@ -17,6 +23,9 @@ const ORG_MOCK = { | |
getUsername() { | ||
return USERNAME | ||
}, | ||
getConnection() { | ||
return CONN_MOCK | ||
}, | ||
} | ||
|
||
const PROJECT_CONFIG_MOCK = { | ||
|
@@ -145,4 +154,22 @@ describe('sf env create compute', () => { | |
expect(ctx.stderr).to.contain('error!') | ||
expect(ctx.stdout).to.contain(`Compute Environment ID: ${APP_MOCK.name}`) | ||
}) | ||
|
||
test | ||
.stdout() | ||
.stderr() | ||
.do(() => { | ||
orgStub = sandbox.stub(Org, 'create' as any).returns(ORG_MOCK) | ||
sandbox.stub(SfdxProject, 'resolve' as any).returns(PROJECT_MOCK) | ||
CONN_MOCK.metadata.list = sinon.stub().throws('INVALID_TYPE') | ||
}) | ||
.finally(() => { | ||
sandbox.restore() | ||
sinon.restore() | ||
}) | ||
.command(['env:create:compute']) | ||
.catch(error => { | ||
expect(error.message).to.contain('The org you are attempting to create a compute environment for does not have the Functions feature enabled.') | ||
}) | ||
.it('displays an informative error message if the org doesn\'t have functions enabled') | ||
}) |