@@ -11,7 +11,14 @@ import { Ux, stubSfCommandUx } from '@salesforce/sf-plugins-core';
1111import { expect , config } from 'chai' ;
1212import { TestService } from '@salesforce/apex-node' ;
1313import Test from '../../../../src/commands/apex/get/test.js' ;
14- import { runWithFailures , testRunSimple , testRunSimpleResult , testRunWithFailuresResult } from '../../../testData.js' ;
14+ import {
15+ runWithCoverage ,
16+ runWithFailureAndSuccess ,
17+ runWithFailures ,
18+ testRunSimple ,
19+ testRunSimpleResult ,
20+ testRunWithFailuresResult ,
21+ } from '../../../testData.js' ;
1522
1623config . truncateThreshold = 0 ;
1724
@@ -105,6 +112,16 @@ describe('apex:test:report', () => {
105112 await Test . run ( [ '--output-dir' , 'myDirectory' , '--test-run-id' , '707xxxxxxxxxxxx' , '--result-format' , 'human' ] ) ;
106113 expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'Test result files written to myDirectory' ) ;
107114 } ) ;
115+
116+ it ( 'should only display failed test with human format with concise flag' , async ( ) => {
117+ sandbox . stub ( TestService . prototype , 'reportAsyncResults' ) . resolves ( runWithFailureAndSuccess ) ;
118+ await Test . run ( [ '--test-run-id' , '707xxxxxxxxxxxx' , '--result-format' , 'human' , '--concise' ] ) ;
119+ expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'Test Summary' ) ;
120+ expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'Test Results' ) ;
121+ expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'MyFailingTest' ) ;
122+ expect ( logStub . firstCall . args [ 0 ] ) . to . not . contain ( 'MyPassingTest' ) ;
123+ expect ( logStub . firstCall . args [ 0 ] ) . to . not . contain ( 'Apex Code Coverage by Class' ) ;
124+ } ) ;
108125 } ) ;
109126
110127 describe ( 'test success' , ( ) => {
@@ -168,5 +185,13 @@ describe('apex:test:report', () => {
168185 await Test . run ( [ '--output-dir' , 'myDirectory' , '--test-run-id' , '707xxxxxxxxxxxx' , '--result-format' , 'human' ] ) ;
169186 expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'Test result files written to myDirectory' ) ;
170187 } ) ;
188+
189+ it ( 'should only display summary with human format and code coverage and concise parameters' , async ( ) => {
190+ sandbox . stub ( TestService . prototype , 'reportAsyncResults' ) . resolves ( runWithCoverage ) ;
191+ await Test . run ( [ '--test-run-id' , '707xxxxxxxxxxxx' , '--result-format' , 'human' , '--code-coverage' , '--concise' ] ) ;
192+ expect ( logStub . firstCall . args [ 0 ] ) . to . contain ( 'Test Summary' ) ;
193+ expect ( logStub . firstCall . args [ 0 ] ) . to . not . contain ( 'Test Results' ) ;
194+ expect ( logStub . firstCall . args [ 0 ] ) . to . not . contain ( 'Apex Code Coverage by Class' ) ;
195+ } ) ;
171196 } ) ;
172197} ) ;
0 commit comments