77import { expect , config as chaiConfig } from 'chai' ;
88import { MockTestOrgData , TestContext } from '@salesforce/core/lib/testSetup' ;
99import { Connection } from '@salesforce/core' ;
10- import { stubSfCommandUx , stubUx } from '@salesforce/sf-plugins-core' ;
10+ import { stubSfCommandUx } from '@salesforce/sf-plugins-core' ;
1111import { OrgDisplayCommand } from '../../../src/commands/org/display' ;
1212import { OrgListUtil } from '../../../src/shared/orgListUtil' ;
1313import { OrgDisplayReturn } from '../../../src/shared/orgTypes' ;
@@ -17,6 +17,10 @@ chaiConfig.truncateThreshold = 0;
1717const refreshToken = '5Aep8616XE5JLxJp3EMunMMUzXg.Ye8T6EJDtnvz0aSok0TzLMkNbW7YRi99Yx85XLvz6zP44x_hVTl8pIW8S5_IW' ;
1818
1919describe ( 'org:display' , ( ) => {
20+ // Create new TestContext, which automatically creates and restores stubs
21+ // pertaining to authorization, orgs, config files, etc...
22+ // There is no need to call $$.restore() in afterEach() since that is
23+ // done automatically by the TestContext.
2024 const $$ = new TestContext ( ) ;
2125 let testOrg = new MockTestOrgData ( ) ;
2226 let sfCommandUxStubs : ReturnType < typeof stubSfCommandUx > ;
@@ -32,7 +36,9 @@ describe('org:display', () => {
3236 beforeEach ( ( ) => {
3337 testOrg = new MockTestOrgData ( ) ;
3438 testOrg . orgId = '00Dxx0000000000' ;
35- stubUx ( $$ . SANDBOX ) ;
39+ // Stub the ux methods on SfCommand so that you don't get any command output in your tests.
40+ // You can also make assertions on the ux methods to ensure that they are called with the
41+ // correct arguments.
3642 sfCommandUxStubs = stubSfCommandUx ( $$ . SANDBOX ) ;
3743 } ) ;
3844
0 commit comments