UNPKG

@salesforce/salesforcedx-vscode-test-tools

Version:
57 lines 3.07 kB
"use strict"; /* * Copyright (c) 2024, salesforce.com, inc. * All rights reserved. * 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 */ Object.defineProperty(exports, "__esModule", { value: true }); const mocha_steps_1 = require("mocha-steps"); const environmentSettings_1 = require("../../src/environmentSettings"); const chai_1 = require("chai"); const system_operations_1 = require("../../src/system-operations"); describe('CLI Commands', () => { const environmentSettings = environmentSettings_1.EnvironmentSettings.getInstance(); const devHubUserName = environmentSettings.devHubUserName; const devHubAliasName = environmentSettings.devHubAliasName; // eslint-disable-next-line @typescript-eslint/no-explicit-any let scratchOrg; (0, mocha_steps_1.step)('Authorize to Testing Org', async () => { if (!devHubUserName) { throw new Error('No DEV_HUB_USER_NAME provided'); } const authorizeOrg = await (0, system_operations_1.orgLoginSfdxUrl)(); (0, chai_1.expect)(authorizeOrg.stdout).to.include(`Successfully authorized ${devHubUserName}`); const setAliasResult = await (0, system_operations_1.setAlias)(devHubAliasName, devHubUserName); (0, chai_1.expect)(setAliasResult.stdout).to.include(devHubAliasName); (0, chai_1.expect)(setAliasResult.stdout).to.include(devHubUserName); (0, chai_1.expect)(setAliasResult.stdout).to.include('true'); }); (0, mocha_steps_1.step)('Create a scratch org', async () => { const scratchOrgResult = await (0, system_operations_1.scratchOrgCreate)('developer', 'NONE', 'foo', 1); (0, chai_1.expect)(scratchOrgResult.exitCode).to.equal(0); }); (0, mocha_steps_1.step)('Find scratch org using org list', async () => { const orgListResult = await (0, system_operations_1.orgList)(); (0, chai_1.expect)(orgListResult.exitCode).to.equal(0); const orgs = JSON.parse(orgListResult.stdout); // eslint-disable-next-line @typescript-eslint/no-unused-expressions (0, chai_1.expect)(orgs).to.not.be.undefined; // eslint-disable-next-line @typescript-eslint/no-explicit-any scratchOrg = orgs.result.scratchOrgs.find((org) => org.alias === 'foo'); // eslint-disable-next-line @typescript-eslint/no-unused-expressions (0, chai_1.expect)(scratchOrg).to.not.be.undefined; }); (0, mocha_steps_1.step)('Display org using org display', async () => { const orgDisplayResult = await (0, system_operations_1.orgDisplay)('foo'); const org = JSON.parse(orgDisplayResult.stdout); // eslint-disable-next-line @typescript-eslint/no-unused-expressions (0, chai_1.expect)(org).to.not.be.undefined; }); after('Delete the scratch org', async () => { if (scratchOrg) { await (0, system_operations_1.deleteScratchOrg)('foo'); } }); }); //# sourceMappingURL=cliCommands.test.js.map