Skip to content

Commit

Permalink
test: alias nuts don't expect consistent order of aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Apr 2, 2024
1 parent 5e9ec8b commit e8e0bba
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 288 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^3.20.0",
"@oclif/core": "^3.26.0",
"@salesforce/core": "^6.7.3",
"@salesforce/sf-plugins-core": "^8.0.2",
"fast-levenshtein": "^3.0.0"
Expand All @@ -15,9 +15,8 @@
"@oclif/test": "^3.2.8",
"@salesforce/cli-plugins-testkit": "^5.1.13",
"@salesforce/dev-scripts": "^8.4.2",
"@salesforce/kit": "^3.0.15",
"@salesforce/plugin-command-reference": "^3.0.73",
"@salesforce/plugin-deploy-retrieve": "^1.20.3",
"@salesforce/plugin-deploy-retrieve": "^3.5.2",
"@salesforce/ts-sinon": "^1.4.17",
"@types/fast-levenshtein": "^0.0.4",
"eslint-plugin-sf-plugin": "^1.17.4",
Expand Down
5 changes: 3 additions & 2 deletions test/commands/alias/list.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ describe('alias list NUTs', () => {

it('lists multiple results correctly JSON', () => {
const result = execCmd('alias list --json', { ensureExitCode: 0 }).jsonOutput?.result;
expect(result).to.deep.equal([
expect(result).lengthOf(3);
[
{
alias: 'DevHub',
value: '[email protected]',
Expand All @@ -89,7 +90,7 @@ describe('alias list NUTs', () => {
alias: 'user',
value: '[email protected]',
},
]);
].map((expected) => expect(result).to.deep.include(expected));
});

it('lists multiple results correctly stdout', () => {
Expand Down
1 change: 0 additions & 1 deletion test/commands/alias/list.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { expect, test } from '@oclif/test';
import { TestContext } from '@salesforce/core/lib/testSetup.js';

Expand Down
18 changes: 9 additions & 9 deletions test/commands/alias/unset.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ describe('alias unset NUTs', () => {
]);

const res = execCmd<AliasResults>('alias list --json', { ensureExitCode: 0 }).jsonOutput?.result;

expect(res).to.deep.equal([
expect(res).lengthOf(2);
[
{
alias: 'Admin',
value: '[email protected]',
Expand All @@ -78,7 +78,7 @@ describe('alias unset NUTs', () => {
alias: 'user',
value: '[email protected]',
},
]);
].map((expected) => expect(res).to.deep.include(expected));
});

it('alias unset DevHub', () => {
Expand Down Expand Up @@ -118,8 +118,8 @@ describe('alias unset NUTs', () => {

it('alias unset --json', () => {
const result = execCmd('alias unset DevHub user --json', { ensureExitCode: 0 }).jsonOutput?.result;

expect(result).to.deep.equal([
expect(result).lengthOf(2);
[
{
alias: 'DevHub',
success: true,
Expand All @@ -130,7 +130,7 @@ describe('alias unset NUTs', () => {
success: true,
value: '[email protected]',
},
]);
].map((expected) => expect(result).to.deep.include(expected));

const res = execCmd('alias list --json', { ensureExitCode: 0 }).jsonOutput?.result;

Expand All @@ -155,8 +155,8 @@ describe('alias unset NUTs', () => {

it('removes all aliases when passing --all', () => {
const result = execCmd('alias unset --all --no-prompt --json', { ensureExitCode: 0 }).jsonOutput?.result;

expect(result).to.deep.equal([
expect(result).lengthOf(3);
[
{
alias: 'Admin',
success: true,
Expand All @@ -172,7 +172,7 @@ describe('alias unset NUTs', () => {
success: true,
value: '[email protected]',
},
]);
].map((expected) => expect(result).to.deep.include(expected));

const res = execCmd('alias list --json', { ensureExitCode: 0 }).jsonOutput?.result;

Expand Down
2 changes: 1 addition & 1 deletion test/commands/sfdx/config/get.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ chaiConfig.truncateThreshold = 0;

describe('config:get NUTs', async () => {
testSession = await TestSession.create({
project: { name: 'configGetNUTs' },
project: { name: 'configGetNUTs-sfdx' },
devhubAuthStrategy: 'NONE',
});

Expand Down
2 changes: 1 addition & 1 deletion test/commands/sfdx/config/list.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let testSession: TestSession;

describe('config:list NUTs', async () => {
testSession = await TestSession.create({
project: { name: 'configListNUTs' },
project: { name: 'configListNUTs-sfdx' },
devhubAuthStrategy: 'NONE',
});
describe('config:list with no configs set', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/commands/sfdx/config/set.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function verifyKeysAndValuesStdout(key: string, value: string | boolean, asserti

describe('config:set NUTs', async () => {
testSession = await TestSession.create({
project: { name: 'configSetNUTs' },
project: { name: 'configSetNUTs-sfdx' },
devhubAuthStrategy: 'NONE',
});

Expand Down
2 changes: 1 addition & 1 deletion test/commands/sfdx/config/unset.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let testSession: TestSession;

describe('config:unset NUTs', async () => {
testSession = await TestSession.create({
project: { name: 'configUnsetNUTs' },
project: { name: 'configUnsetNUTs-sfdx' },
});

describe('config:unset without keys', () => {
Expand Down
Loading

0 comments on commit e8e0bba

Please sign in to comment.