mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 08:56:37 +07:00 
			
		
		
		
	Fixed breaking test case
This commit is contained in:
		@ -102,7 +102,7 @@ test("restore on GHES with AC available ", async () => {
 | 
				
			|||||||
    const infoMock = jest.spyOn(core, "info");
 | 
					    const infoMock = jest.spyOn(core, "info");
 | 
				
			||||||
    const failedMock = jest.spyOn(core, "setFailed");
 | 
					    const failedMock = jest.spyOn(core, "setFailed");
 | 
				
			||||||
    const stateMock = jest.spyOn(core, "saveState");
 | 
					    const stateMock = jest.spyOn(core, "saveState");
 | 
				
			||||||
    const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
 | 
					    const setCacheHitOutputMock = jest.spyOn(core, "setOutput");
 | 
				
			||||||
    const restoreCacheMock = jest
 | 
					    const restoreCacheMock = jest
 | 
				
			||||||
        .spyOn(cache, "restoreCache")
 | 
					        .spyOn(cache, "restoreCache")
 | 
				
			||||||
        .mockImplementationOnce(() => {
 | 
					        .mockImplementationOnce(() => {
 | 
				
			||||||
@ -116,7 +116,7 @@ test("restore on GHES with AC available ", async () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
					    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledWith(true);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
 | 
					    expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
 | 
				
			||||||
    expect(failedMock).toHaveBeenCalledTimes(0);
 | 
					    expect(failedMock).toHaveBeenCalledTimes(0);
 | 
				
			||||||
@ -270,7 +270,7 @@ test("restore with cache found for key", async () => {
 | 
				
			|||||||
    const infoMock = jest.spyOn(core, "info");
 | 
					    const infoMock = jest.spyOn(core, "info");
 | 
				
			||||||
    const failedMock = jest.spyOn(core, "setFailed");
 | 
					    const failedMock = jest.spyOn(core, "setFailed");
 | 
				
			||||||
    const stateMock = jest.spyOn(core, "saveState");
 | 
					    const stateMock = jest.spyOn(core, "saveState");
 | 
				
			||||||
    const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
 | 
					    const setCacheHitOutputMock = jest.spyOn(core, "setOutput");
 | 
				
			||||||
    const restoreCacheMock = jest
 | 
					    const restoreCacheMock = jest
 | 
				
			||||||
        .spyOn(cache, "restoreCache")
 | 
					        .spyOn(cache, "restoreCache")
 | 
				
			||||||
        .mockImplementationOnce(() => {
 | 
					        .mockImplementationOnce(() => {
 | 
				
			||||||
@ -284,7 +284,7 @@ test("restore with cache found for key", async () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
					    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledWith(true);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "true");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
 | 
					    expect(infoMock).toHaveBeenCalledWith(`Cache restored from key: ${key}`);
 | 
				
			||||||
    expect(failedMock).toHaveBeenCalledTimes(0);
 | 
					    expect(failedMock).toHaveBeenCalledTimes(0);
 | 
				
			||||||
@ -303,7 +303,7 @@ test("restore with cache found for restore key", async () => {
 | 
				
			|||||||
    const infoMock = jest.spyOn(core, "info");
 | 
					    const infoMock = jest.spyOn(core, "info");
 | 
				
			||||||
    const failedMock = jest.spyOn(core, "setFailed");
 | 
					    const failedMock = jest.spyOn(core, "setFailed");
 | 
				
			||||||
    const stateMock = jest.spyOn(core, "saveState");
 | 
					    const stateMock = jest.spyOn(core, "saveState");
 | 
				
			||||||
    const setCacheHitOutputMock = jest.spyOn(actionUtils, "setCacheHitOutput");
 | 
					    const setCacheHitOutputMock = jest.spyOn(core, "setOutput");
 | 
				
			||||||
    const restoreCacheMock = jest
 | 
					    const restoreCacheMock = jest
 | 
				
			||||||
        .spyOn(cache, "restoreCache")
 | 
					        .spyOn(cache, "restoreCache")
 | 
				
			||||||
        .mockImplementationOnce(() => {
 | 
					        .mockImplementationOnce(() => {
 | 
				
			||||||
@ -317,8 +317,7 @@ test("restore with cache found for restore key", async () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
					    expect(stateMock).toHaveBeenCalledWith("CACHE_KEY", key);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledTimes(1);
 | 
				
			||||||
    expect(setCacheHitOutputMock).toHaveBeenCalledWith(false);
 | 
					    expect(setCacheHitOutputMock).toHaveBeenCalledWith("cache-hit", "false");
 | 
				
			||||||
 | 
					 | 
				
			||||||
    expect(infoMock).toHaveBeenCalledWith(
 | 
					    expect(infoMock).toHaveBeenCalledWith(
 | 
				
			||||||
        `Cache restored from key: ${restoreKey}`
 | 
					        `Cache restored from key: ${restoreKey}`
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user