@@ -16,19 +16,19 @@ import * as installer from "../src/installer";
1616
1717describe ( "filename tests" , ( ) => {
1818 const tests = [
19- [ "protoc-3.20 .2-linux-x86_32.zip" , "linux" , "" ] ,
20- [ "protoc-3.20 .2-linux-x86_64.zip" , "linux" , "x64" ] ,
21- [ "protoc-3.20 .2-linux-aarch_64.zip" , "linux" , "arm64" ] ,
22- [ "protoc-3.20 .2-linux-ppcle_64.zip" , "linux" , "ppc64" ] ,
23- [ "protoc-3.20 .2-linux-s390_64.zip" , "linux" , "s390x" ] ,
24- [ "protoc-3.20 .2-osx-aarch_64.zip" , "darwin" , "arm64" ] ,
25- [ "protoc-3.20 .2-osx-x86_64.zip" , "darwin" , "x64" ] ,
26- [ "protoc-3.20 .2-win64.zip" , "win32" , "x64" ] ,
27- [ "protoc-3.20 .2-win32.zip" , "win32" , "x32" ]
19+ [ "protoc-23 .2-linux-x86_32.zip" , "linux" , "" ] ,
20+ [ "protoc-23 .2-linux-x86_64.zip" , "linux" , "x64" ] ,
21+ [ "protoc-23 .2-linux-aarch_64.zip" , "linux" , "arm64" ] ,
22+ [ "protoc-23 .2-linux-ppcle_64.zip" , "linux" , "ppc64" ] ,
23+ [ "protoc-23 .2-linux-s390_64.zip" , "linux" , "s390x" ] ,
24+ [ "protoc-23 .2-osx-aarch_64.zip" , "darwin" , "arm64" ] ,
25+ [ "protoc-23 .2-osx-x86_64.zip" , "darwin" , "x64" ] ,
26+ [ "protoc-23 .2-win64.zip" , "win32" , "x64" ] ,
27+ [ "protoc-23 .2-win32.zip" , "win32" , "x32" ]
2828 ] ;
2929 for ( const [ expected , plat , arch ] of tests ) {
3030 it ( `downloads ${ expected } correctly` , ( ) => {
31- const actual = installer . getFileName ( "3.20 .2" , plat , arch ) ;
31+ const actual = installer . getFileName ( "23 .2" , plat , arch ) ;
3232 expect ( expected ) . toBe ( actual ) ;
3333 } ) ;
3434 }
@@ -52,8 +52,8 @@ describe("installer tests", () => {
5252 } ) ;
5353
5454 it ( "Downloads version of protoc if no matching version is installed" , async ( ) => {
55- await installer . getProtoc ( "3.9 .0" , true , GITHUB_TOKEN ) ;
56- const protocDir = path . join ( toolDir , "protoc" , "3.9 .0" , os . arch ( ) ) ;
55+ await installer . getProtoc ( "v23 .0" , true , GITHUB_TOKEN ) ;
56+ const protocDir = path . join ( toolDir , "protoc" , "v23 .0" , os . arch ( ) ) ;
5757
5858 expect ( fs . existsSync ( `${ protocDir } .complete` ) ) . toBe ( true ) ;
5959
@@ -79,30 +79,28 @@ describe("installer tests", () => {
7979 nock ( "https://api.github.com" )
8080 . get ( "/repos/protocolbuffers/protobuf/releases?page=3" )
8181 . replyWithFile ( 200 , path . join ( dataDir , "releases-3.json" ) ) ;
82+
83+ nock ( "https://api.github.com" )
84+ . get ( "/repos/protocolbuffers/protobuf/releases?page=4" )
85+ . replyWithFile ( 200 , path . join ( dataDir , "releases-4.json" ) ) ;
86+
87+ nock ( "https://api.github.com" )
88+ . get ( "/repos/protocolbuffers/protobuf/releases?page=5" )
89+ . replyWithFile ( 200 , path . join ( dataDir , "releases-5.json" ) ) ;
90+
91+ nock ( "https://api.github.com" )
92+ . get ( "/repos/protocolbuffers/protobuf/releases?page=6" )
93+ . replyWithFile ( 200 , path . join ( dataDir , "releases-6.json" ) ) ;
8294 } ) ;
8395
8496 afterEach ( ( ) => {
8597 nock . cleanAll ( ) ;
8698 nock . enableNetConnect ( ) ;
8799 } ) ;
88100
89- it ( "Gets the latest 3.7.x version of protoc using 3.7 and no matching version is installed" , async ( ) => {
90- await installer . getProtoc ( "3.7" , true , GITHUB_TOKEN ) ;
91- const protocDir = path . join ( toolDir , "protoc" , "3.7.1" , os . arch ( ) ) ;
92-
93- expect ( fs . existsSync ( `${ protocDir } .complete` ) ) . toBe ( true ) ;
94- if ( IS_WINDOWS ) {
95- expect ( fs . existsSync ( path . join ( protocDir , "bin" , "protoc.exe" ) ) ) . toBe (
96- true
97- ) ;
98- } else {
99- expect ( fs . existsSync ( path . join ( protocDir , "bin" , "protoc" ) ) ) . toBe ( true ) ;
100- }
101- } , 100000 ) ;
102-
103- it ( "Gets latest version of protoc using 3.x and no matching version is installed" , async ( ) => {
104- await installer . getProtoc ( "3.x" , true , GITHUB_TOKEN ) ;
105- const protocDir = path . join ( toolDir , "protoc" , "3.12.4" , os . arch ( ) ) ;
101+ it ( "Gets the latest v23.1 version of protoc using v23.1 and no matching version is installed" , async ( ) => {
102+ await installer . getProtoc ( "v23.1" , true , GITHUB_TOKEN ) ;
103+ const protocDir = path . join ( toolDir , "protoc" , "v23.1" , os . arch ( ) ) ;
106104
107105 expect ( fs . existsSync ( `${ protocDir } .complete` ) ) . toBe ( true ) ;
108106 if ( IS_WINDOWS ) {
@@ -113,31 +111,10 @@ describe("installer tests", () => {
113111 expect ( fs . existsSync ( path . join ( protocDir , "bin" , "protoc" ) ) ) . toBe ( true ) ;
114112 }
115113 } , 100000 ) ;
116- } ) ;
117-
118- describe ( "Gets the latest release of protoc with broken latest rc tag" , ( ) => {
119- beforeEach ( ( ) => {
120- nock ( "https://api.github.com" )
121- . get ( "/repos/protocolbuffers/protobuf/releases?page=1" )
122- . replyWithFile ( 200 , path . join ( dataDir , "releases-broken-rc-tag.json" ) ) ;
123-
124- nock ( "https://api.github.com" )
125- . get ( "/repos/protocolbuffers/protobuf/releases?page=2" )
126- . replyWithFile ( 200 , path . join ( dataDir , "releases-2.json" ) ) ;
127-
128- nock ( "https://api.github.com" )
129- . get ( "/repos/protocolbuffers/protobuf/releases?page=3" )
130- . replyWithFile ( 200 , path . join ( dataDir , "releases-3.json" ) ) ;
131- } ) ;
132-
133- afterEach ( ( ) => {
134- nock . cleanAll ( ) ;
135- nock . enableNetConnect ( ) ;
136- } ) ;
137114
138- it ( "Gets latest version of protoc using 3 .x with a broken rc tag, filtering pre-releases " , async ( ) => {
139- await installer . getProtoc ( "3 .x" , false , "" ) ;
140- const protocDir = path . join ( toolDir , "protoc" , "3.9.1 " , os . arch ( ) ) ;
115+ it ( "Gets latest version of protoc using v22 .x and no matching version is installed " , async ( ) => {
116+ await installer . getProtoc ( "v22 .x" , true , GITHUB_TOKEN ) ;
117+ const protocDir = path . join ( toolDir , "protoc" , "v22.5 " , os . arch ( ) ) ;
141118
142119 expect ( fs . existsSync ( `${ protocDir } .complete` ) ) . toBe ( true ) ;
143120 if ( IS_WINDOWS ) {
0 commit comments