Skip to content

Commit

Permalink
test: nut for remote-only source delete interactive (#988)
Browse files Browse the repository at this point in the history
* fix: missing walkContent on delete prompt

* test: nut for remote-only source delete interactive

* chore: bump testkit

* test: no interactive tests on win

* test: don't run on windows

---------

Co-authored-by: Cristian Dominguez <[email protected]>
  • Loading branch information
mshanemc and cristiand391 authored Apr 29, 2024
1 parent 35eac28 commit b75ae63
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.1.6",
"@salesforce/cli-plugins-testkit": "^5.2.0",
"@salesforce/cli-plugins-testkit": "^5.3.0",
"@salesforce/dev-scripts": "^9.0.0",
"@salesforce/plugin-command-reference": "^3.0.82",
"@salesforce/source-testkit": "^2.2.5",
Expand Down
24 changes: 22 additions & 2 deletions test/nuts/delete/source.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@

import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { platform } from 'node:os';
import * as path from 'node:path';
import { expect, assert } from 'chai';
import { execCmd } from '@salesforce/cli-plugins-testkit';
import { expect, assert, config } from 'chai';
import { Interaction, execCmd, execInteractiveCmd } from '@salesforce/cli-plugins-testkit';
import { SourceTestkit } from '@salesforce/source-testkit';
import { FileResponse } from '@salesforce/source-deploy-retrieve';
import { AuthInfo, Connection } from '@salesforce/core';
import { ensureArray } from '@salesforce/ts-types';
import { DeleteSourceJson } from '../../../src/utils/types.js';

config.truncateThreshold = 0;

const isNameObsolete = async (username: string, memberType: string, memberName: string): Promise<boolean> => {
const connection = await Connection.create({
authInfo: await AuthInfo.create({ username }),
Expand Down Expand Up @@ -265,4 +268,21 @@ describe('project delete source NUTs', () => {
expect(await isNameObsolete(testkit.username, 'LightningComponentBundle', 'brokerCard')).to.be.false;
expect(fs.existsSync(brokerPath)).to.be.true;
});

(platform() === 'win32' ? it.skip : it)('deletes a remote-only layout using interactive prompt', async () => {
const layoutName = 'Account-Account %28Marketing%29 Layout';
const response = (
await execInteractiveCmd(
['project:delete:source', '--metadata', `Layout:${layoutName}`],
{
'Are you sure': Interaction.Yes,
},
{
ensureExitCode: 0,
}
)
).stdout;
expect(response).to.include('Deleted Source');
expect(response).to.include(layoutName);
});
});
33 changes: 4 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@
istanbul-lib-report "^3.0.1"
istanbul-reports "^3.1.6"

"@salesforce/cli-plugins-testkit@^5.2.0", "@salesforce/cli-plugins-testkit@^5.2.1":
"@salesforce/cli-plugins-testkit@^5.2.1", "@salesforce/cli-plugins-testkit@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-5.3.0.tgz#ec7c8da49c36e4c07f6ddc80cb57776e687e4925"
integrity sha512-g+kmsucxS8QBxlV9gjltl4lVW8GjvtlQNUijhtZEqm9Vwb0s5MG/K0wfzg2MwVUZ+ZwNWgcKnRruD5K8LzMZkA==
Expand Down Expand Up @@ -7454,16 +7454,7 @@ srcset@^5.0.0:
resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.0.tgz#9df6c3961b5b44a02532ce6ae4544832609e2e3f"
integrity sha512-SqEZaAEhe0A6ETEa9O1IhSPC7MdvehZtCnTR0AftXk3QhY2UNgb+NApFOUPZILXk/YTDfFxMTNJOBpzrJsEdIA==

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -7522,14 +7513,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -8067,7 +8051,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -8085,15 +8069,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit b75ae63

Please sign in to comment.