@@ -2,20 +2,15 @@ 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' ;
89
910describe ( 'cache-restore' , ( ) => {
1011 process . env [ 'GITHUB_WORKSPACE' ] = path . join ( __dirname , 'data' ) ;
11- if ( ! process . env . RUNNER_OS ) {
12- process . env . RUNNER_OS = 'Linux' ;
13- }
14- if ( ! process . env . RUNNER_ARCH ) {
15- process . env . RUNNER_ARCH = 'X64' ;
16- }
17- const platform = process . env . RUNNER_OS ;
18- const arch = process . env . RUNNER_ARCH ;
12+ const platform = 'Linux' ;
13+ const arch = 'arm64' ;
1914 const commonPath = '/some/random/path' ;
2015 const npmCachePath = `${ commonPath } /npm` ;
2116 const pnpmCachePath = `${ commonPath } /pnpm` ;
@@ -56,6 +51,8 @@ describe('cache-restore', () => {
5651 let getCommandOutputSpy : jest . SpyInstance ;
5752 let restoreCacheSpy : jest . SpyInstance ;
5853 let hashFilesSpy : jest . SpyInstance ;
54+ let archSpy : jest . SpyInstance ;
55+ let platformSpy : jest . SpyInstance ;
5956
6057 beforeEach ( ( ) => {
6158 // core
@@ -106,6 +103,13 @@ describe('cache-restore', () => {
106103
107104 // cache-utils
108105 getCommandOutputSpy = jest . spyOn ( utils , 'getCommandOutput' ) ;
106+
107+ // os
108+ archSpy = jest . spyOn ( osm , 'arch' ) ;
109+ archSpy . mockImplementation ( ( ) => arch ) ;
110+
111+ platformSpy = jest . spyOn ( osm , 'platform' ) ;
112+ platformSpy . mockImplementation ( ( ) => platform ) ;
109113 } ) ;
110114
111115 describe ( 'Validate provided package manager' , ( ) => {
0 commit comments