File tree 4 files changed +173
-360
lines changed
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
184
184
) ;
185
185
}
186
186
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
+ } ) ;
200
212
} ,
201
213
30000
202
214
) ;
You can’t perform that action at this time.
0 commit comments