@@ -56,6 +56,46 @@ jest.mock('../GitForWindowsHelper/github-api-request', () => {
5656 return mockGithubApiRequest
5757} )
5858
59+ const mockFetchHTML = {
60+ 'https://cygwin.com' : `<div>
61+
62+ <h2 class="cartouche">Cygwin version</h2>
63+
64+ <p>
65+ The most recent version of the Cygwin DLL is
66+ <b><a href="https://cygwin.com/pipermail/cygwin-announce/2023-September/011291.html">3.4.9</a></b>.
67+ </p>
68+ <p>
69+ The Cygwin DLL currently works with all recent, commercially released
70+ x86_64 versions of Windows, starting with Windows 7.
71+ </p>
72+ </div>` ,
73+ 'https://inbox.sourceware.org/cygwin-announce/?q=cygwin-3.4.7' : `<html><head><title>cygwin-3.4.7 - search results</title>[... plenty of stuff...]
74+ <pre>1. <b><a
75+ href="875y7c63s1.fsf@Rainer.invalid/">Re-Released: tar-1.34-2</a></b>
76+ - by ASSI @ 2023-06-24 19:47 UTC [4%]
77+
78+ 2. <b><a
79+ href="20230616162552.879387-1-corinna-cygwin@cygwin.com/">cygwin 3.4.7-1</a></b>
80+ - by Corinna Vinschen @ 2023-06-16 14:25 UTC [14%]
81+
82+ </pre>[... even more stuff...]</body></html>`
83+ }
84+ const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86_64.pkg.tar.xz'
85+ const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz'
86+ const bogus32BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/i686/msys2-runtime-3.4.9-1-i686.pkg.tar.xz'
87+ const bogus64BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/x86-64/msys2-runtime-3.3-3.3.7-1-x86_64.pkg.tar.xz'
88+ const mockDoesURLReturn404 = jest . fn ( url => [
89+ missingURL , missingMinTTYURL , bogus32BitMSYS2RuntimeURL , bogus64BitMSYS2RuntimeURL
90+ ] . includes ( url ) )
91+ jest . mock ( '../GitForWindowsHelper/https-request' , ( ) => {
92+ return {
93+ doesURLReturn404 : mockDoesURLReturn404 ,
94+ fetchHTML : jest . fn ( url => mockFetchHTML [ url ] )
95+ }
96+ } )
97+
98+
5999test ( 'guessReleaseNotes()' , async ( ) => {
60100 const context = { log : jest . fn ( ) }
61101 expect ( await guessReleaseNotes ( context , {
@@ -127,20 +167,31 @@ http://www.gnutls.org/news.html#2023-02-10`
127167 package : 'openssl' ,
128168 version : '3.1.1'
129169 } )
130- } )
131170
132- test ( 'getMissingDeployments()' , async ( ) => {
133- const missingURL = 'https://wingit.blob.core.windows.net/x86-64/curl-8.1.2-1-x86_64.pkg.tar.xz'
134- const missingMinTTYURL = 'https://wingit.blob.core.windows.net/i686/mintty-1~3.6.5-1-i686.pkg.tar.xz'
135- const bogus32BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/i686/msys2-runtime-3.4.9-1-i686.pkg.tar.xz'
136- const bogus64BitMSYS2RuntimeURL = 'https://wingit.blob.core.windows.net/x86-64/msys2-runtime-3.3-3.3.7-1-x86_64.pkg.tar.xz'
137- const mockDoesURLReturn404 = jest . fn ( url => [
138- missingURL , missingMinTTYURL , bogus32BitMSYS2RuntimeURL , bogus64BitMSYS2RuntimeURL
139- ] . includes ( url ) )
140- jest . mock ( '../GitForWindowsHelper/https-request' , ( ) => {
141- return { doesURLReturn404 : mockDoesURLReturn404 }
171+ expect ( await guessReleaseNotes ( context , {
172+ labels : [ { name : 'component-update' } ] ,
173+ title : '[New cygwin version] cygwin-3.4.9' ,
174+ body : `\nCygwin 3.4.9 release\n\nhttps://github.com/cygwin/cygwin/releases/tag/cygwin-3.4.9`
175+ } ) ) . toEqual ( {
176+ type : 'feature' ,
177+ message : 'Comes with the MSYS2 runtime (Git for Windows flavor) based on [Cygwin v3.4.9](https://cygwin.com/pipermail/cygwin-announce/2023-September/011291.html).' ,
178+ package : 'msys2-runtime' ,
179+ version : '3.4.9'
142180 } )
143181
182+ expect ( await guessReleaseNotes ( context , {
183+ labels : [ { name : 'component-update' } ] ,
184+ title : '[New cygwin version] cygwin-3.4.7' ,
185+ body : `\nCygwin 3.4.7 release\n\nhttps://github.com/cygwin/cygwin/releases/tag/cygwin-3.4.7`
186+ } ) ) . toEqual ( {
187+ type : 'feature' ,
188+ message : 'Comes with the MSYS2 runtime (Git for Windows flavor) based on [Cygwin v3.4.7](https://inbox.sourceware.org/cygwin-announce/20230616162552.879387-1-corinna-cygwin@cygwin.com/).' ,
189+ package : 'msys2-runtime' ,
190+ version : '3.4.7'
191+ } )
192+ } )
193+
194+ test ( 'getMissingDeployments()' , async ( ) => {
144195 expect ( await getMissingDeployments ( 'curl' , '8.1.2' ) ) . toEqual ( [ missingURL ] )
145196 expect ( await getMissingDeployments ( 'mintty' , '3.6.5' ) ) . toEqual ( [ missingMinTTYURL ] )
146197 expect ( await getMissingDeployments ( 'msys2-runtime' , '3.4.9' ) ) . toEqual ( [ ] )
0 commit comments