@@ -2,6 +2,7 @@ import * as core from '@actions/core';
22import * as cache from '@actions/cache' ;
33import * as path from 'path' ;
44import * as glob from '@actions/glob' ;
5+ import osm from 'os' ;
56
67import * as utils from '../src/cache-utils' ;
78import { restoreCache } from '../src/cache-restore' ;
@@ -12,6 +13,7 @@ describe('cache-restore', () => {
1213 process . env . RUNNER_OS = 'Linux' ;
1314 }
1415 const platform = process . env . RUNNER_OS ;
16+ const arch = 'arm64' ;
1517 const commonPath = '/some/random/path' ;
1618 const npmCachePath = `${ commonPath } /npm` ;
1719 const pnpmCachePath = `${ commonPath } /pnpm` ;
@@ -52,6 +54,7 @@ describe('cache-restore', () => {
5254 let getCommandOutputSpy : jest . SpyInstance ;
5355 let restoreCacheSpy : jest . SpyInstance ;
5456 let hashFilesSpy : jest . SpyInstance ;
57+ let archSpy : jest . SpyInstance ;
5558
5659 beforeEach ( ( ) => {
5760 // core
@@ -102,6 +105,10 @@ describe('cache-restore', () => {
102105
103106 // cache-utils
104107 getCommandOutputSpy = jest . spyOn ( utils , 'getCommandOutput' ) ;
108+
109+ // os
110+ archSpy = jest . spyOn ( osm , 'arch' ) ;
111+ archSpy . mockImplementation ( ( ) => arch ) ;
105112 } ) ;
106113
107114 describe ( 'Validate provided package manager' , ( ) => {
@@ -135,7 +142,7 @@ describe('cache-restore', () => {
135142 await restoreCache ( packageManager , '' ) ;
136143 expect ( hashFilesSpy ) . toHaveBeenCalled ( ) ;
137144 expect ( infoSpy ) . toHaveBeenCalledWith (
138- `Cache restored from key: node-cache-${ platform } -${ packageManager } -${ fileHash } `
145+ `Cache restored from key: node-cache-${ platform } -${ arch } - ${ packageManager } -${ fileHash } `
139146 ) ;
140147 expect ( infoSpy ) . not . toHaveBeenCalledWith (
141148 `${ packageManager } cache is not found`
0 commit comments