@@ -39,9 +39,7 @@ describe('force:source:retrieve', () => {
3939 let retrieveStub : sinon . SinonStub ;
4040 let pollStub : sinon . SinonStub ;
4141 let lifecycleEmitStub : sinon . SinonStub ;
42- // TODO: remove the next two stubs when reverting back to SDR polling
43- let checkStatusStub : sinon . SinonStub ;
44- let postStub : sinon . SinonStub ;
42+ let resolveProjectConfigStub : sinon . SinonStub ;
4543
4644 class TestRetrieve extends Retrieve {
4745 public async runIt ( ) {
@@ -63,6 +61,7 @@ describe('force:source:retrieve', () => {
6361 stubInterface < SfdxProject > ( sandbox , {
6462 getDefaultPackage : ( ) => ( { fullPath : defaultPackagePath } ) ,
6563 getUniquePackageDirectories : ( ) => [ { fullPath : defaultPackagePath } ] ,
64+ resolveProjectConfig : resolveProjectConfigStub ,
6665 } )
6766 ) ;
6867 cmd . setProject ( sfdxProjectStub ) ;
@@ -80,14 +79,11 @@ describe('force:source:retrieve', () => {
8079 } ;
8180
8281 beforeEach ( ( ) => {
82+ resolveProjectConfigStub = sandbox . stub ( ) ;
8383 pollStub = sandbox . stub ( ) . resolves ( retrieveResult ) ;
84- checkStatusStub = sandbox . stub ( ) . resolves ( retrieveResult ) ;
85- postStub = sandbox . stub ( ) . resolves ( retrieveResult ) ;
8684 retrieveStub = sandbox . stub ( ) . resolves ( {
8785 pollStatus : pollStub ,
8886 retrieveId : retrieveResult . response . id ,
89- checkStatus : checkStatusStub ,
90- post : postStub ,
9187 } ) ;
9288 buildComponentSetStub = stubMethod ( sandbox , ComponentSetBuilder , 'build' ) . resolves ( {
9389 retrieve : retrieveStub ,
@@ -111,6 +107,7 @@ describe('force:source:retrieve', () => {
111107 manifest : undefined ,
112108 metadata : undefined ,
113109 apiversion : undefined ,
110+ sourceapiversion : undefined ,
114111 } ;
115112 const expectedArgs = { ...defaultArgs , ...overrides } ;
116113
@@ -124,7 +121,7 @@ describe('force:source:retrieve', () => {
124121 usernameOrConnection : username ,
125122 merge : true ,
126123 output : defaultPackagePath ,
127- packageNames : undefined ,
124+ packageOptions : undefined ,
128125 } ;
129126 const expectedRetrieveArgs = { ...defaultRetrieveArgs , ...overrides } ;
130127
@@ -195,6 +192,23 @@ describe('force:source:retrieve', () => {
195192 ensureHookArgs ( ) ;
196193 } ) ;
197194
195+ it ( 'should pass along sourceapiversion' , async ( ) => {
196+ const sourceApiVersion = '50.0' ;
197+ resolveProjectConfigStub . resolves ( { sourceApiVersion } ) ;
198+ const manifest = 'package.xml' ;
199+ const result = await runRetrieveCmd ( [ '--manifest' , manifest , '--json' ] ) ;
200+ expect ( result ) . to . deep . equal ( expectedResults ) ;
201+ ensureCreateComponentSetArgs ( {
202+ sourceapiversion : sourceApiVersion ,
203+ manifest : {
204+ manifestPath : manifest ,
205+ directoryPaths : [ defaultPackagePath ] ,
206+ } ,
207+ } ) ;
208+ ensureRetrieveArgs ( ) ;
209+ ensureHookArgs ( ) ;
210+ } ) ;
211+
198212 it ( 'should pass along packagenames' , async ( ) => {
199213 const manifest = 'package.xml' ;
200214 const packagenames = [ 'package1' ] ;
@@ -207,7 +221,7 @@ describe('force:source:retrieve', () => {
207221 directoryPaths : [ defaultPackagePath ] ,
208222 } ,
209223 } ) ;
210- ensureRetrieveArgs ( { packageNames : packagenames } ) ;
224+ ensureRetrieveArgs ( { packageOptions : packagenames } ) ;
211225 ensureHookArgs ( ) ;
212226 } ) ;
213227
0 commit comments