File tree Expand file tree Collapse file tree 4 files changed +173
-360
lines changed Expand file tree Collapse file tree 4 files changed +173
-360
lines changed Original file line number Diff line number Diff line change @@ -184,19 +184,31 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
184184 ) ;
185185 }
186186
187- if ( process . platform === 'linux' && packageManager === 'pip' ) {
188- expect ( infoSpy ) . toHaveBeenCalledWith (
189- `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -20.04-Ubuntu-python-${ pythonVersion } -${ packageManager } -${ fileHash } `
190- ) ;
191- } else if ( packageManager === 'poetry' ) {
192- expect ( infoSpy ) . toHaveBeenCalledWith (
193- `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -python-${ pythonVersion } -${ packageManager } -v2-${ fileHash } `
194- ) ;
195- } else {
196- expect ( infoSpy ) . toHaveBeenCalledWith (
197- `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -python-${ pythonVersion } -${ packageManager } -${ fileHash } `
198- ) ;
199- }
187+ const restoredKeys = restoreCacheSpy . mock . results . map (
188+ result => result . value
189+ ) ;
190+
191+ restoredKeys . forEach ( restoredKey => {
192+ if ( restoredKey ) {
193+ if ( process . platform === 'linux' && packageManager === 'pip' ) {
194+ expect ( infoSpy ) . toHaveBeenCalledWith (
195+ `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -20.04-Ubuntu-python-${ pythonVersion } -${ packageManager } -${ fileHash } `
196+ ) ;
197+ } else if ( packageManager === 'poetry' ) {
198+ expect ( infoSpy ) . toHaveBeenCalledWith (
199+ `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -python-${ pythonVersion } -${ packageManager } -v2-${ fileHash } `
200+ ) ;
201+ } else {
202+ expect ( infoSpy ) . toHaveBeenCalledWith (
203+ `Cache restored from key: setup-python-${ process . env [ 'RUNNER_OS' ] } -${ process . arch } -python-${ pythonVersion } -${ packageManager } -${ fileHash } `
204+ ) ;
205+ }
206+ } else {
207+ expect ( infoSpy ) . toHaveBeenCalledWith (
208+ `${ packageManager } cache is not found`
209+ ) ;
210+ }
211+ } ) ;
200212 } ,
201213 30000
202214 ) ;
You can’t perform that action at this time.
0 commit comments