mirror of
				https://github.com/actions/cache.git
				synced 2025-10-31 11:48:38 +08:00 
			
		
		
		
	Arrange args in restore tests
This commit is contained in:
		
							parent
							
								
									29f7388d53
								
							
						
					
					
						commit
						1860decefb
					
				|  | @ -263,12 +263,16 @@ test("restore with cache found", async () => { | ||||||
|     expect(mkdirMock).toHaveBeenCalledWith(cachePath); |     expect(mkdirMock).toHaveBeenCalledWith(cachePath); | ||||||
| 
 | 
 | ||||||
|     const IS_WINDOWS = process.platform === "win32"; |     const IS_WINDOWS = process.platform === "win32"; | ||||||
|     const tarArchivePath = IS_WINDOWS |     const args = IS_WINDOWS | ||||||
|         ? archivePath.replace(/\\/g, "/") |         ? [ | ||||||
|         : archivePath; |               "-xz", | ||||||
|     const tarCachePath = IS_WINDOWS ? cachePath.replace(/\\/g, "/") : cachePath; |               "--force-local", | ||||||
|     const args = IS_WINDOWS ? ["-xz", "--force-local"] : ["-xz"]; |               "-f", | ||||||
|     args.push(...["-f", tarArchivePath, "-C", tarCachePath]); |               archivePath.replace(/\\/g, "/"), | ||||||
|  |               "-C", | ||||||
|  |               cachePath.replace(/\\/g, "/") | ||||||
|  |           ] | ||||||
|  |         : ["-xz", "-f", archivePath, "-C", cachePath]; | ||||||
| 
 | 
 | ||||||
|     expect(execMock).toHaveBeenCalledTimes(1); |     expect(execMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); |     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); | ||||||
|  | @ -340,12 +344,16 @@ test("restore with a pull request event and cache found", async () => { | ||||||
|     expect(mkdirMock).toHaveBeenCalledWith(cachePath); |     expect(mkdirMock).toHaveBeenCalledWith(cachePath); | ||||||
| 
 | 
 | ||||||
|     const IS_WINDOWS = process.platform === "win32"; |     const IS_WINDOWS = process.platform === "win32"; | ||||||
|     const tarArchivePath = IS_WINDOWS |     const args = IS_WINDOWS | ||||||
|         ? archivePath.replace(/\\/g, "/") |         ? [ | ||||||
|         : archivePath; |               "-xz", | ||||||
|     const tarCachePath = IS_WINDOWS ? cachePath.replace(/\\/g, "/") : cachePath; |               "--force-local", | ||||||
|     const args = IS_WINDOWS ? ["-xz", "--force-local"] : ["-xz"]; |               "-f", | ||||||
|     args.push(...["-f", tarArchivePath, "-C", tarCachePath]); |               archivePath.replace(/\\/g, "/"), | ||||||
|  |               "-C", | ||||||
|  |               cachePath.replace(/\\/g, "/") | ||||||
|  |           ] | ||||||
|  |         : ["-xz", "-f", archivePath, "-C", cachePath]; | ||||||
| 
 | 
 | ||||||
|     expect(execMock).toHaveBeenCalledTimes(1); |     expect(execMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); |     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); | ||||||
|  | @ -417,12 +425,16 @@ test("restore with cache found for restore key", async () => { | ||||||
|     expect(mkdirMock).toHaveBeenCalledWith(cachePath); |     expect(mkdirMock).toHaveBeenCalledWith(cachePath); | ||||||
| 
 | 
 | ||||||
|     const IS_WINDOWS = process.platform === "win32"; |     const IS_WINDOWS = process.platform === "win32"; | ||||||
|     const tarArchivePath = IS_WINDOWS |     const args = IS_WINDOWS | ||||||
|         ? archivePath.replace(/\\/g, "/") |         ? [ | ||||||
|         : archivePath; |               "-xz", | ||||||
|     const tarCachePath = IS_WINDOWS ? cachePath.replace(/\\/g, "/") : cachePath; |               "--force-local", | ||||||
|     const args = IS_WINDOWS ? ["-xz", "--force-local"] : ["-xz"]; |               "-f", | ||||||
|     args.push(...["-f", tarArchivePath, "-C", tarCachePath]); |               archivePath.replace(/\\/g, "/"), | ||||||
|  |               "-C", | ||||||
|  |               cachePath.replace(/\\/g, "/") | ||||||
|  |           ] | ||||||
|  |         : ["-xz", "-f", archivePath, "-C", cachePath]; | ||||||
| 
 | 
 | ||||||
|     expect(execMock).toHaveBeenCalledTimes(1); |     expect(execMock).toHaveBeenCalledTimes(1); | ||||||
|     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); |     expect(execMock).toHaveBeenCalledWith(`"tar"`, args); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Josh Gross
						Josh Gross