@@ -98,31 +98,35 @@ describe('findPackageForDownload', () => {
9898 } ) ;
9999
100100 it . each ( [
101- [ 'amd64' , 'x64' ] ,
102- [ 'arm64' , 'aarch64' ]
101+ [ 'amd64' , [ 'x64' , 'amd64' ] ] ,
102+ [ 'arm64' , [ 'aarch64' , 'arm64' ] ]
103103 ] ) (
104104 'defaults to os.arch(): %s mapped to distro arch: %s' ,
105- async ( osArch : string , distroArch : string ) => {
106- jest . spyOn ( os , 'arch' ) . mockReturnValue ( osArch ) ;
107- jest . spyOn ( os , 'platform' ) . mockReturnValue ( 'linux' ) ;
105+ async ( osArch : string , distroArchs : string [ ] ) => {
106+ jest
107+ . spyOn ( os , 'arch' )
108+ . mockReturnValue ( osArch as ReturnType < typeof os . arch > ) ;
108109
109- const version = '21' ;
110- const distro = new GraalVMDistribution ( {
111- version,
110+ const distribution = new GraalVMDistribution ( {
111+ version : '21' ,
112112 architecture : '' , // to get default value
113113 packageType : 'jdk' ,
114114 checkLatest : false
115115 } ) ;
116116
117117 const osType = distribution . getPlatform ( ) ;
118- if ( osType === 'windows' && distroArch == 'aarch64' ) {
118+ if ( osType === 'windows' && distroArchs . includes ( 'aarch64' ) ) {
119119 return ; // skip, aarch64 is not available for Windows
120120 }
121121 const archiveType = getDownloadArchiveExtension ( ) ;
122- const result = await distro [ 'findPackageForDownload' ] ( version ) ;
123- const expectedUrl = `https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${ osType } -${ distroArch } _bin.${ archiveType } ` ;
122+ const result = await distribution [ 'findPackageForDownload' ] ( '21' ) ;
124123
125- expect ( result . url ) . toBe ( expectedUrl ) ;
124+ const expectedUrls = distroArchs . map (
125+ distroArch =>
126+ `https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_${ osType } -${ distroArch } _bin.${ archiveType } `
127+ ) ;
128+
129+ expect ( expectedUrls ) . toContain ( result . url ) ;
126130 }
127131 ) ;
128132
0 commit comments