@@ -8,6 +8,7 @@ import path from 'path';
88import * as main from '../src/main' ;
99import * as im from '../src/installer' ;
1010import * as httpm from '@actions/http-client' ;
11+ import { getArch } from '../src/system' ;
1112
1213import goJsonData from './data/golang-dl.json' ;
1314import matchers from '../matchers.json' ;
@@ -32,6 +33,7 @@ describe('setup-go', () => {
3233 let getSpy : jest . SpyInstance ;
3334 let platSpy : jest . SpyInstance ;
3435 let archSpy : jest . SpyInstance ;
36+ let endianSpy : jest . SpyInstance ;
3537 let joinSpy : jest . SpyInstance ;
3638 let dlSpy : jest . SpyInstance ;
3739 let extractTarSpy : jest . SpyInstance ;
@@ -71,6 +73,8 @@ describe('setup-go', () => {
7173 archSpy = jest . spyOn ( osm , 'arch' ) ;
7274 archSpy . mockImplementation ( ( ) => os [ 'arch' ] ) ;
7375 execSpy = jest . spyOn ( cp , 'execSync' ) ;
76+ endianSpy = jest . spyOn ( osm , 'endianness' ) ;
77+ endianSpy . mockImplementation ( ( ) => os [ 'endianness' ] ) ;
7478
7579 // switch path join behaviour based on set os.platform
7680 joinSpy = jest . spyOn ( path , 'join' ) ;
@@ -988,5 +992,17 @@ use .
988992 ) ;
989993 }
990994 ) ;
995+
996+ it ( 'should return ppc64 when architecture is ppc64 and system is Big Endian' , ( ) => {
997+ endianSpy . mockReturnValue ( 'BE' ) ;
998+ const result = getArch ( 'ppc64' ) ;
999+ expect ( result ) . toBe ( 'ppc64' ) ;
1000+ } ) ;
1001+
1002+ it ( 'should return ppc64le when architecture is ppc64 and system is Little Endian' , ( ) => {
1003+ endianSpy . mockReturnValue ( 'LE' ) ;
1004+ const result = getArch ( 'ppc64' ) ;
1005+ expect ( result ) . toBe ( 'ppc64le' ) ;
1006+ } ) ;
9911007 } ) ;
9921008} ) ;
0 commit comments