@@ -7,6 +7,7 @@ import osm, {type} from 'os';
77import path from 'path' ;
88import * as main from '../src/main' ;
99import * as im from '../src/installer' ;
10+ import { getArch } from "../src/system" ;
1011
1112import goJsonData from './data/golang-dl.json' ;
1213import matchers from '../matchers.json' ;
@@ -31,6 +32,7 @@ describe('setup-go', () => {
3132 let getSpy : jest . SpyInstance ;
3233 let platSpy : jest . SpyInstance ;
3334 let archSpy : jest . SpyInstance ;
35+ let endianSpy : jest . SpyInstance ;
3436 let joinSpy : jest . SpyInstance ;
3537 let dlSpy : jest . SpyInstance ;
3638 let extractTarSpy : jest . SpyInstance ;
@@ -69,6 +71,8 @@ describe('setup-go', () => {
6971 archSpy = jest . spyOn ( osm , 'arch' ) ;
7072 archSpy . mockImplementation ( ( ) => os [ 'arch' ] ) ;
7173 execSpy = jest . spyOn ( cp , 'execSync' ) ;
74+ endianSpy = jest . spyOn ( osm , 'endianness' ) ;
75+ endianSpy . mockImplementation ( ( ) => os [ 'endianness' ] ) ;
7276
7377 // switch path join behaviour based on set os.platform
7478 joinSpy = jest . spyOn ( path , 'join' ) ;
@@ -965,5 +969,17 @@ use .
965969 ) ;
966970 }
967971 ) ;
972+
973+ it ( 'should return ppc64 when architecture is ppc64 and system is Big Endian' , ( ) => {
974+ endianSpy . mockReturnValue ( 'BE' ) ;
975+ const result = getArch ( 'ppc64' ) ;
976+ expect ( result ) . toBe ( 'ppc64' ) ;
977+ } ) ;
978+
979+ it ( 'should return ppc64le when architecture is ppc64 and system is Little Endian' , ( ) => {
980+ endianSpy . mockReturnValue ( 'LE' ) ;
981+ const result = getArch ( 'ppc64' ) ;
982+ expect ( result ) . toBe ( 'ppc64le' ) ;
983+ } ) ;
968984 } ) ;
969985} ) ;
0 commit comments