Skip to content

Commit

Permalink
test: nut changes for new org-list table
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Aug 9, 2023
1 parent a1c3366 commit 5060b0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/commands/org/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import { ExtendedAuthFields, FullyPopulatedScratchOrgFields } from '../../shared
Messages.importMessagesDirectory(__dirname);
const messages = Messages.loadMessages('@salesforce/plugin-org', 'list');

const defaultOrgEmoji = '🍁';
const defaultHubEmoji = '🌳';
export const defaultOrgEmoji = '🍁';
export const defaultHubEmoji = '🌳';

export type OrgListResult = {
/**
Expand Down
17 changes: 13 additions & 4 deletions test/nut/listAndDisplay.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { expect, config, assert } from 'chai';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { execCmd } from '@salesforce/cli-plugins-testkit';
import { getString } from '@salesforce/ts-types';
import { OrgListResult } from '../../src/commands/org/list';
import { OrgListResult, defaultHubEmoji, defaultOrgEmoji } from '../../src/commands/org/list';
import { OrgOpenOutput } from '../../src/commands/org/open';
import { OrgDisplayReturn } from '../../src/shared/orgTypes';

Expand All @@ -27,11 +27,11 @@ const verifyHumanResults = (
expect(lines.length).to.have.greaterThan(0);
const devHubLine = lines.find((line) => line.includes(hubOrgUsername));
assert(devHubLine);
expect(devHubLine).to.include('(D)');
expect(devHubLine).to.include(defaultHubEmoji);
expect(devHubLine).to.include('Connected');
const defaultUserLine = lines.find((line) => line.includes(defaultUsername));
assert(defaultUserLine);
expect(defaultUserLine).to.include('(U)');
expect(defaultUserLine).to.include(defaultOrgEmoji);
const aliasUserLine = lines.find((line) => line.includes(aliasedUsername));
assert(aliasUserLine);
expect(aliasUserLine).to.include('anAlias');
Expand Down Expand Up @@ -100,8 +100,8 @@ describe('Org Command NUT', () => {
expect(listResult.scratchOrgs).to.have.length(2);
const scratchOrgs = listResult.scratchOrgs;
expect(scratchOrgs.map((scratchOrg) => getString(scratchOrg, 'username'))).to.deep.equal([
defaultUsername,
aliasedUsername,
defaultUsername,
]);
expect(scratchOrgs.find((org) => org.username === defaultUsername)).to.include({
defaultMarker: '(U)',
Expand All @@ -121,6 +121,15 @@ describe('Org Command NUT', () => {
},
JSON.stringify(listResult.nonScratchOrgs[0])
);
expect(listResult.devHubs[0]).to.include(
{
username: hubOrgUsername,
defaultMarker: '(D)',
isDevHub: true,
connectedStatus: 'Connected',
},
JSON.stringify(listResult.nonScratchOrgs[0])
);
});
it('should list orgs - skip-connection-status', () => {
const listResult = execCmd<OrgListResult>('org:list --skip-connection-status --json', { ensureExitCode: 0 })
Expand Down

0 comments on commit 5060b0a

Please sign in to comment.