Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions test/commands/apex/run/test.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,100 @@ describe('apex:test:run', () => {
expect(logStub.firstCall.args[0]).to.include('MyApexTests.testConfig Pass 53');
});

it('should parse tests flags correctly comma separated', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['--tests', 'MyApexTests,MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
tests: [
{
className: 'MyApexTests',
},
{
className: 'MySecondTest',
},
],
});
});

it('should parse tests flags correctly multi-flag', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['--tests', 'MyApexTests', '--tests', 'MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
tests: [
{
className: 'MyApexTests',
},
{
className: 'MySecondTest',
},
],
});
});

it('should parse class-names flags correctly comma separated', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['--class-names', 'MyApexTests,MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
tests: [
{
className: 'MyApexTests',
},
{
className: 'MySecondTest',
},
],
});
});

it('should parse class-names (-n) flags correctly multi-flag', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['-n', 'MyApexTests', '-n', 'MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
tests: [
{
className: 'MyApexTests',
},
{
className: 'MySecondTest',
},
],
});
});

it('should parse suite-names flags correctly comma separated', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['--suite-names', 'MyApexTests,MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
suiteNames: 'MyApexTests,MySecondTest',
});
});

it('should parse suite-names (-s) flags correctly multi-flag', async () => {
const apexStub = sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

await new Test(['-s', 'MyApexTests', '-s', 'MySecondTest', '--result-format', 'human'], config).run();
expect(apexStub.firstCall.args[0]).to.deep.equal({
skipCodeCoverage: true,
testLevel: 'RunSpecifiedTests',
suiteNames: 'MyApexTests,MySecondTest',
});
});

it('should return a success tap format message with async', async () => {
sandbox.stub(TestService.prototype, 'runTestAsynchronous').resolves(testRunSimple);

Expand Down