Skip to content

Commit 1fd5aad

Browse files
committed
chore: code review
1 parent f176629 commit 1fd5aad

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@oclif/core": "^2.3.0",
1010
"@salesforce/core": "^3.33.4",
1111
"@salesforce/kit": "^1.9.0",
12-
"@salesforce/sf-plugins-core": "^2.2.2",
12+
"@salesforce/sf-plugins-core": "^2.2.3",
1313
"open": "8.4.1",
1414
"tslib": "^2"
1515
},

test/unit/org/display.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { expect, config as chaiConfig } from 'chai';
88
import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup';
99
import { Connection } from '@salesforce/core';
10-
import { stubSfCommandUx, stubUx } from '@salesforce/sf-plugins-core';
10+
import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
1111
import { OrgDisplayCommand } from '../../../src/commands/org/display';
1212
import { OrgListUtil } from '../../../src/shared/orgListUtil';
1313
import { OrgDisplayReturn } from '../../../src/shared/orgTypes';
@@ -17,6 +17,10 @@ chaiConfig.truncateThreshold = 0;
1717
const refreshToken = '5Aep8616XE5JLxJp3EMunMMUzXg.Ye8T6EJDtnvz0aSok0TzLMkNbW7YRi99Yx85XLvz6zP44x_hVTl8pIW8S5_IW';
1818

1919
describe('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

test/unit/org/list.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ import * as chaiAsPromised from 'chai-as-promised';
99
import { TestContext } from '@salesforce/core/lib/testSetup';
1010
import { AuthInfo, Connection, Org } from '@salesforce/core';
1111
import { stubMethod } from '@salesforce/ts-sinon';
12-
import { SfCommand, stubSfCommandUx, stubUx } from '@salesforce/sf-plugins-core';
12+
import { SfCommand, stubSfCommandUx } from '@salesforce/sf-plugins-core';
1313
import OrgListMock = require('../../shared/orgListMock');
1414
import { OrgListCommand } from '../../../src/commands/org/list';
1515
import { OrgListUtil } from '../../../src/shared/orgListUtil';
1616

1717
ChaiUse(chaiAsPromised);
1818

1919
describe('org:list', () => {
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

2226
beforeEach(async () => {
23-
stubUx($$.SANDBOX);
27+
// Stub the ux methods on SfCommand so that you don't get any command output in your tests.
2428
stubSfCommandUx($$.SANDBOX);
2529
stubMethod($$.SANDBOX, AuthInfo, 'listAllAuthorizations').resolves([
2630
'Jimi Hendrix',

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,10 +1141,10 @@
11411141
chalk "^4"
11421142
inquirer "^8.2.5"
11431143

1144-
"@salesforce/sf-plugins-core@^2.2.2":
1145-
version "2.2.2"
1146-
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-2.2.2.tgz#ddecd6abc3a76a9bc201703f6f2971c8cf79b308"
1147-
integrity sha512-MQtfbpBJQbHpIxK1o5rpfPzPto4tWxBywJUvc1baTblafGyX7IZUt9Sl2Ld4XKgWga/7lxJNFfAnrbJLuIVe9Q==
1144+
"@salesforce/sf-plugins-core@^2.2.3":
1145+
version "2.2.3"
1146+
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-2.2.3.tgz#f491156fbd83b18d01d943a43396a57009d10b42"
1147+
integrity sha512-B+ITa19o2ChAQXWNjmqxtXy7Bn0+dOcFwxqUhVR4YJ7wBzgvvGQ/pvG/WOah+v/uza91Jqfokq59D14fNAQfPw==
11481148
dependencies:
11491149
"@oclif/core" "^2.2.1"
11501150
"@salesforce/core" "^3.33.1"

0 commit comments

Comments
 (0)