Skip to content

Commit 3ae5564

Browse files
committed
test(forge-site-parser): Add 1.20.1 website test case
1 parent ae5deb6 commit 3ae5564

File tree

2 files changed

+236
-0
lines changed

2 files changed

+236
-0
lines changed

mock/sample-forge-new.html

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
<body>
2+
<li class="elem-active">1.20.1</li>
3+
<table class="download-list">
4+
<thead>
5+
<tr>
6+
<th>Version</th>
7+
<th>Time</th>
8+
<th>Downloads</th>
9+
</tr>
10+
</thead>
11+
<thead class="mobile-only">
12+
<tr>
13+
<th>Downloads</th>
14+
</tr>
15+
</thead>
16+
<tbody>
17+
<tr>
18+
<td class="download-version">
19+
47.3.27
20+
<i class="promo-latest fa" aria-hidden="true"></i>
21+
</td>
22+
<td class="download-time" title="2025-01-28 04:32:36">2025-01-28</td>
23+
<td class="download-files">
24+
<ul class="download-links">
25+
26+
<li>
27+
<a
28+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-changelog.txt">
29+
<i class="fa download-classifier classifier-changelog" aria-hidden="true"></i> Changelog
30+
</a>&nbsp;
31+
<a class="info-link tooltipstered" data-toggle="popup">
32+
<i class="fa fa-info-circle" aria-hidden="true"></i>
33+
</a>
34+
<div class="info-tooltip">
35+
<strong>MD5:</strong> 366cace3c2e174fdc5997e9e4d7a4eae<br>
36+
<strong>SHA1:</strong> 71b25641db940d0c740c0c84047a930fe8b11dc0
37+
</div>
38+
</li>
39+
40+
<li>
41+
<a
42+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-installer.jar">
43+
<i class="fa download-classifier classifier-installer" aria-hidden="true"></i> Installer
44+
</a>&nbsp;
45+
<a class="info-link tooltipstered" data-toggle="popup"
46+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-installer.jar">
47+
<i class="fa fa-info-circle" aria-hidden="true"></i>
48+
</a>
49+
<div class="info-tooltip">
50+
<strong>MD5:</strong> 9c7f5b4a7020efa788f59263b0b32765<br>
51+
<strong>SHA1:</strong> 5503fdb855bd19de6d08c494261f069c7ec3b310
52+
<br><a
53+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-installer.jar">(Direct
54+
Download)</a>
55+
</div>
56+
</li>
57+
58+
<li>
59+
<a
60+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-mdk.zip">
61+
<i class="fa download-classifier classifier-mdk" aria-hidden="true"></i> Mdk
62+
</a>&nbsp;
63+
<a class="info-link tooltipstered" data-toggle="popup"
64+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-mdk.zip">
65+
<i class="fa fa-info-circle" aria-hidden="true"></i>
66+
</a>
67+
<div class="info-tooltip">
68+
<strong>MD5:</strong> 4412a191a613d4d168a87e4c7da52cf2<br>
69+
<strong>SHA1:</strong> e254d73a926a0f6c0b6415ecfae9571d1cd34dd8
70+
<br><strong>Gradle:</strong> '1.20.1-47.3.27'
71+
<br><a
72+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.27/forge-1.20.1-47.3.27-mdk.zip">(Direct
73+
Download)</a>
74+
</div>
75+
</li>
76+
77+
78+
79+
80+
</ul>
81+
</td>
82+
</tr>
83+
84+
<tr>
85+
<td class="download-version">
86+
47.3.0
87+
<i class="promo-recommended fa" aria-hidden="true"></i>
88+
</td>
89+
<td class="download-time" title="2024-06-03 21:02:18">2024-06-03</td>
90+
<td class="download-files">
91+
<ul class="download-links">
92+
93+
<li>
94+
<a
95+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-changelog.txt">
96+
<i class="fa download-classifier classifier-changelog" aria-hidden="true"></i> Changelog
97+
</a>&nbsp;
98+
<a class="info-link tooltipstered" data-toggle="popup">
99+
<i class="fa fa-info-circle" aria-hidden="true"></i>
100+
</a>
101+
<div class="info-tooltip">
102+
<strong>MD5:</strong> a27eab69db46240dd83bb54877721741<br>
103+
<strong>SHA1:</strong> abdbe20c5124a5f6419d3197bf7a1665ccf85308
104+
</div>
105+
</li>
106+
107+
<li>
108+
<a
109+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-installer.jar">
110+
<i class="fa download-classifier classifier-installer" aria-hidden="true"></i> Installer
111+
</a>&nbsp;
112+
<a class="info-link tooltipstered" data-toggle="popup"
113+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-installer.jar">
114+
<i class="fa fa-info-circle" aria-hidden="true"></i>
115+
</a>
116+
<div class="info-tooltip">
117+
<strong>MD5:</strong> ee3ca303001d1e856558b75b2a5854f1<br>
118+
<strong>SHA1:</strong> 0deb8e547a9e3f098a4c9f082903499703c52f5d
119+
<br><a
120+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-installer.jar">(Direct
121+
Download)</a>
122+
</div>
123+
</li>
124+
125+
<li>
126+
<a
127+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-mdk.zip">
128+
<i class="fa download-classifier classifier-mdk" aria-hidden="true"></i> Mdk
129+
</a>&nbsp;
130+
<a class="info-link tooltipstered" data-toggle="popup"
131+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-mdk.zip">
132+
<i class="fa fa-info-circle" aria-hidden="true"></i>
133+
</a>
134+
<div class="info-tooltip">
135+
<strong>MD5:</strong> 2b4ac3068951f6524ca64c6b1eebe2a3<br>
136+
<strong>SHA1:</strong> debdc4cb1e51f46bc50e814e9c7dc0ff92efc56c
137+
<br><strong>Gradle:</strong> '1.20.1-47.3.0'
138+
<br><a
139+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.3.0/forge-1.20.1-47.3.0-mdk.zip">(Direct
140+
Download)</a>
141+
</div>
142+
</li>
143+
144+
145+
146+
147+
</ul>
148+
</td>
149+
</tr>
150+
151+
<tr>
152+
<td class="download-version">
153+
47.2.36
154+
</td>
155+
<td class="download-time" title="2024-06-03 20:35:02">2024-06-03</td>
156+
<td class="download-files">
157+
<ul class="download-links">
158+
159+
<li>
160+
<a
161+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-changelog.txt">
162+
<i class="fa download-classifier classifier-changelog" aria-hidden="true"></i> Changelog
163+
</a>&nbsp;
164+
<a class="info-link tooltipstered" data-toggle="popup">
165+
<i class="fa fa-info-circle" aria-hidden="true"></i>
166+
</a>
167+
<div class="info-tooltip">
168+
<strong>MD5:</strong> 3557a26b5fceafd50ca4c51270afc1d9<br>
169+
<strong>SHA1:</strong> c48f8ca6067365cde0df4dfb18f959a3c7fd9699
170+
</div>
171+
</li>
172+
173+
<li>
174+
<a
175+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-installer.jar">
176+
<i class="fa download-classifier classifier-installer" aria-hidden="true"></i> Installer
177+
</a>&nbsp;
178+
<a class="info-link tooltipstered" data-toggle="popup"
179+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-installer.jar">
180+
<i class="fa fa-info-circle" aria-hidden="true"></i>
181+
</a>
182+
<div class="info-tooltip">
183+
<strong>MD5:</strong> fda0e8f9e3b1ad74b96162e031aa0e6d<br>
184+
<strong>SHA1:</strong> 46afa70615fa005c6aaea5ec54161f25e1432726
185+
<br><a
186+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-installer.jar">(Direct
187+
Download)</a>
188+
</div>
189+
</li>
190+
191+
<li>
192+
<a
193+
href="https://adfoc.us/serve/sitelinks/?id=271228&amp;url=https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-mdk.zip">
194+
<i class="fa download-classifier classifier-mdk" aria-hidden="true"></i> Mdk
195+
</a>&nbsp;
196+
<a class="info-link tooltipstered" data-toggle="popup"
197+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-mdk.zip">
198+
<i class="fa fa-info-circle" aria-hidden="true"></i>
199+
</a>
200+
<div class="info-tooltip">
201+
<strong>MD5:</strong> 24caee665290c2151227c8b82d17b9ae<br>
202+
<strong>SHA1:</strong> 0c8813e16d4a57702fc3b828dabc94f0c88cdb2d
203+
<br><strong>Gradle:</strong> '1.20.1-47.2.36'
204+
<br><a
205+
href="https://maven.minecraftforge.net/net/minecraftforge/forge/1.20.1-47.2.36/forge-1.20.1-47.2.36-mdk.zip">(Direct
206+
Download)</a>
207+
</div>
208+
</li>
209+
210+
211+
212+
213+
</ul>
214+
</td>
215+
</tr>
216+
</tbody>
217+
</table>
218+
</body>

packages/forge-site-parser/index.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,24 @@ describe('ForgeWebpage', () => {
3131
expect(ver.version).toEqual('36.1.3')
3232
expect(ver.installer!.path).toEqual('/maven/net/minecraftforge/forge/1.16.5-36.1.3/forge-1.16.5-36.1.3-installer.jar')
3333
})
34+
35+
test('should parse new forge site', async ({ mock }) => {
36+
const content = await promises.readFile(path.join(mock, 'sample-forge-new.html'))
37+
const page = parse(content.toString())
38+
expect(page).toBeTruthy()
39+
40+
expect(page.versions).toHaveLength(3)
41+
expect(page.mcversion).toEqual('1.20.1')
42+
43+
for (const ver of page.versions) {
44+
expect(ver.type).toBeTruthy()
45+
expect(ver.version).toBeTruthy()
46+
47+
expect(ver.installer!.sha1).toBeTruthy()
48+
expect(ver.installer!.path).toBeTruthy()
49+
expect(ver.installer!.md5).toBeTruthy()
50+
}
51+
})
3452
})
3553

3654
// describe("#getWebPage", () => {

0 commit comments

Comments
 (0)