Skip to content

Commit

Permalink
feat: finish out cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayChipps committed Dec 4, 2023
1 parent 1c30546 commit b11da09
Show file tree
Hide file tree
Showing 7 changed files with 302 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"watch-extensions": "ts",
"recursive": true,
"reporter": "spec",
"timeout": 600000
"timeout": 20000
}
8 changes: 3 additions & 5 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"check-coverage": true,
"lines": 0,
"statements": 0,
"functions": 0,
"branches": 0
"nyc": {
"extends": "@salesforce/dev-config/nyc"
}
}
2 changes: 1 addition & 1 deletion test/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
'no-unused-expressions': 'off',

// It is common for tests to stub out method.

'@typescript-eslint/ban-ts-comment': 'off',
// Return types are defined by the source code. Allows for quick overwrites.
'@typescript-eslint/explicit-function-return-type': 'off',
// Mocked out the methods that shouldn't do anything in the tests.
Expand Down
36 changes: 4 additions & 32 deletions test/commands/chipps/package/dependencies/install.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,17 @@
* For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/MIT
*/

import { TestContext } from '@salesforce/core/lib/testSetup';
import { expect } from 'chai';
import { stubSfCommandUx } from '@salesforce/sf-plugins-core';
import ChippsPackageDependenciesInstall from '..\\..\\..\\..\\..\\src\\commands\\chipps\\package\\dependencies\\install';
import { MockTestOrgData, TestContext } from '@salesforce/core/lib/testSetup';

describe('chipps package dependencies install', () => {
const $$ = new TestContext();
let sfCommandStubs: ReturnType<typeof stubSfCommandUx>;
const testOrg = new MockTestOrgData();

beforeEach(() => {
sfCommandStubs = stubSfCommandUx($$.SANDBOX);
before(async () => {
await $$.stubAuths(testOrg);
});

afterEach(() => {
$$.restore();
});

it('runs hello', async () => {
await ChippsPackageDependenciesInstall.run([]);
const output = sfCommandStubs.log
.getCalls()
.flatMap((c) => c.args)
.join('\n');
expect(output).to.include('hello world');
});

it('runs hello with --json and no provided name', async () => {
const result = await ChippsPackageDependenciesInstall.run([]);
expect(result.path).to.equal(
'C:\\Users\\clayc\\VSCode\\sf-chipps-package\\src\\commands\\chipps\\package\\dependencies\\install.ts'
);
});

it('runs hello world --name Astro', async () => {
await ChippsPackageDependenciesInstall.run(['--name', 'Astro']);
const output = sfCommandStubs.log
.getCalls()
.flatMap((c) => c.args)
.join('\n');
expect(output).to.include('hello Astro');
});
});
Loading

0 comments on commit b11da09

Please sign in to comment.