@@ -105,6 +105,7 @@ function mockOctokitReturnRelease(releaseData: ReleaseData) {
105105}
106106
107107const URL_BASE = "https://api.github.com/repos/google/google-java-format/releases" ;
108+ const URL_TAIL = "?per_page=100" ;
108109
109110describe ( 'get all release data' , ( ) => {
110111 test ( 'get all release data with API' , async ( ) => {
@@ -113,7 +114,7 @@ describe('get all release data', () => {
113114 const results = await releases . getAllReleaseData ( ) ;
114115 expect ( results ) . toEqual ( allReleases ) ;
115116 // IMPORTANT: should not have a trailing slash
116- expectLastCurlCallForUrl ( URL_BASE ) ;
117+ expectLastCurlCallForUrl ( URL_BASE + URL_TAIL ) ;
117118 } ) ;
118119
119120 test ( 'get all release data with API and call to API fails' , async ( ) => {
@@ -124,7 +125,7 @@ describe('get all release data', () => {
124125 . rejects
125126 . toThrow ( error )
126127 // IMPORTANT: should not have a trailing slash
127- expectLastCurlCallForUrl ( URL_BASE ) ;
128+ expectLastCurlCallForUrl ( URL_BASE + URL_TAIL ) ;
128129 } ) ;
129130
130131 test ( 'get all release data with octokit' , async ( ) => {
@@ -148,14 +149,14 @@ describe('get latest release data', () => {
148149 const result = await releases . getLatestReleaseData ( javaVersion ) ;
149150 expect ( result ) . toEqual ( expectedRelease ) ;
150151 // IMPORTANT: should not have a trailing slash
151- expectLastCurlCallForUrl ( URL_BASE ) ;
152+ expectLastCurlCallForUrl ( URL_BASE + URL_TAIL ) ;
152153 } ) ;
153154
154155 test ( 'when java version is 21, then return release latest' , async ( ) => {
155156 mockApiReturnRelease ( dummyReleaseData ) ;
156157 const result = await releases . getLatestReleaseData ( 21 ) ;
157158 expect ( result ) . toEqual ( dummyReleaseData ) ;
158- expectLastCurlCallForUrl ( URL_BASE + "/latest" ) ;
159+ expectLastCurlCallForUrl ( URL_BASE + "/latest" + URL_TAIL ) ;
159160 } ) ;
160161 } ) ;
161162
@@ -166,7 +167,7 @@ describe('get latest release data', () => {
166167 expect ( ( ) => releases . getLatestReleaseData ( 21 ) )
167168 . rejects
168169 . toThrow ( error ) ;
169- expectLastCurlCallForUrl ( URL_BASE + "/latest" ) ;
170+ expectLastCurlCallForUrl ( URL_BASE + "/latest" + URL_TAIL ) ;
170171 } ) ;
171172
172173 describe ( 'get latest release data with octokit' , ( ) => {
@@ -195,7 +196,7 @@ describe('get release by name', () => {
195196 const result = await releases . getReleaseDataByName ( 'dummy-release-data' ) ;
196197 expect ( result ) . toEqual ( dummyReleaseData ) ;
197198 // IMPORTANT: should not have a trailing slash
198- expectLastCurlCallForUrl ( URL_BASE ) ;
199+ expectLastCurlCallForUrl ( URL_BASE + URL_TAIL ) ;
199200 } ) ;
200201
201202 test ( 'get release by name (non-existing)' , async ( ) => {
@@ -204,6 +205,6 @@ describe('get release by name', () => {
204205 const result = await releases . getReleaseDataByName ( 'non-existing-data' ) ;
205206 expect ( result ) . toBeUndefined ( ) ;
206207 // IMPORTANT: should not have a trailing slash
207- expectLastCurlCallForUrl ( URL_BASE ) ;
208+ expectLastCurlCallForUrl ( URL_BASE + URL_TAIL ) ;
208209 } ) ;
209210} ) ;
0 commit comments