@@ -102,6 +102,186 @@ describe('test/common/adapter/binary/GithubBinary.test.ts', () => {
102102 assert . ok ( matchFile3 ) ;
103103 } ) ;
104104
105+ it ( 'should fetch @discordjs/opus' , async ( ) => {
106+ app . mockHttpclient ( / h t t p s : \/ \/ a p i \. g i t h u b \. c o m \/ r e p o s \/ d i s c o r d j s \/ o p u s \/ r e l e a s e s / , 'GET' , {
107+ data : [
108+ {
109+ tag_name : 'v0.10.0' ,
110+ url : 'https://api.github.com/repos/discordjs/opus/releases/196789560' ,
111+ published_at : '2025-01-25T21:10:59Z' ,
112+ tarball_url : 'https://api.github.com/repos/discordjs/opus/tarball/v0.10.0' ,
113+ zipball_url : 'https://api.github.com/repos/discordjs/opus/zipball/v0.10.0' ,
114+ assets : [
115+ {
116+ name : 'opus-v0.10.0-node-v108-napi-v3-darwin-arm64-unknown-unknown.tar.gz' ,
117+ size : 255_918 ,
118+ updated_at : '2025-01-25T21:16:38Z' ,
119+ browser_download_url :
120+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v108-napi-v3-darwin-arm64-unknown-unknown.tar.gz' ,
121+ } ,
122+ {
123+ name : 'opus-v0.10.0-node-v108-napi-v3-linux-x64-glibc-2.35.tar.gz' ,
124+ size : 293_745 ,
125+ updated_at : '2025-01-25T21:21:54Z' ,
126+ browser_download_url :
127+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v108-napi-v3-linux-x64-glibc-2.35.tar.gz' ,
128+ } ,
129+ {
130+ name : 'opus-v0.10.0-node-v102-napi-v3-win32-x64-unknown-unknown.tar.gz' ,
131+ size : 1_161_036 ,
132+ updated_at : '2025-01-25T21:19:32Z' ,
133+ browser_download_url :
134+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v102-napi-v3-win32-x64-unknown-unknown.tar.gz' ,
135+ } ,
136+ ] ,
137+ } ,
138+ ] ,
139+ status : 200 ,
140+ } ) ;
141+ let result = await binary . fetch ( '/' , '@discordjs/opus' ) ;
142+ assert . ok ( result ) ;
143+ assert . ok ( result . items . length > 0 ) ;
144+ let matchDir = false ;
145+ for ( const item of result . items ) {
146+ assert . ok ( item . isDir === true ) ;
147+ if ( item . name === 'v0.10.0/' ) {
148+ assert . equal ( item . date , '2025-01-25T21:10:59Z' ) ;
149+ assert . equal ( item . size , '-' ) ;
150+ matchDir = true ;
151+ }
152+ }
153+ assert . ok ( matchDir ) ;
154+
155+ result = await binary . fetch ( '/v0.10.0/' , '@discordjs/opus' ) ;
156+ assert . ok ( result ) ;
157+ assert . ok ( result . items . length > 0 ) ;
158+ let matchFile1 = false ;
159+ let matchFile2 = false ;
160+ let matchFile3 = false ;
161+ let matchFile4 = false ;
162+ for ( const item of result . items ) {
163+ assert . ok ( item . isDir === false ) ;
164+ if ( item . name === 'opus-v0.10.0-node-v108-napi-v3-darwin-arm64-unknown-unknown.tar.gz' ) {
165+ assert . equal ( item . date , '2025-01-25T21:16:38Z' ) ;
166+ assert . equal ( item . size , 255_918 ) ;
167+ assert . equal (
168+ item . url ,
169+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v108-napi-v3-darwin-arm64-unknown-unknown.tar.gz' ,
170+ ) ;
171+ matchFile1 = true ;
172+ }
173+ if ( item . name === 'opus-v0.10.0-node-v108-napi-v3-linux-x64-glibc-2.35.tar.gz' ) {
174+ assert . equal ( item . date , '2025-01-25T21:21:54Z' ) ;
175+ assert . equal ( item . size , 293_745 ) ;
176+ assert . equal (
177+ item . url ,
178+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v108-napi-v3-linux-x64-glibc-2.35.tar.gz' ,
179+ ) ;
180+ matchFile2 = true ;
181+ }
182+ if ( item . name === 'opus-v0.10.0-node-v102-napi-v3-win32-x64-unknown-unknown.tar.gz' ) {
183+ assert . equal ( item . date , '2025-01-25T21:19:32Z' ) ;
184+ assert . equal ( item . size , 1_161_036 ) ;
185+ assert . equal (
186+ item . url ,
187+ 'https://github.com/discordjs/opus/releases/download/v0.10.0/opus-v0.10.0-node-v102-napi-v3-win32-x64-unknown-unknown.tar.gz' ,
188+ ) ;
189+ matchFile3 = true ;
190+ }
191+ if ( item . name === 'v0.10.0.tar.gz' ) {
192+ assert . equal ( item . url , 'https://github.com/discordjs/opus/archive/v0.10.0.tar.gz' ) ;
193+ matchFile4 = true ;
194+ }
195+ }
196+ assert . ok ( matchFile1 ) ;
197+ assert . ok ( matchFile2 ) ;
198+ assert . ok ( matchFile3 ) ;
199+ assert . ok ( matchFile4 ) ;
200+ } ) ;
201+
202+ it ( 'should fetch @matrix-org/matrix-sdk-crypto-nodejs' , async ( ) => {
203+ app . mockHttpclient (
204+ / h t t p s : \/ \/ a p i \. g i t h u b \. c o m \/ r e p o s \/ m a t r i x - o r g \/ m a t r i x - r u s t - s d k - c r y p t o - n o d e j s \/ r e l e a s e s / ,
205+ 'GET' ,
206+ {
207+ data : [
208+ {
209+ tag_name : 'v0.4.0' ,
210+ url : 'https://api.github.com/repos/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/277244048' ,
211+ published_at : '2026-01-16T01:50:49Z' ,
212+ tarball_url : 'https://api.github.com/repos/matrix-org/matrix-rust-sdk-crypto-nodejs/tarball/v0.4.0' ,
213+ zipball_url : 'https://api.github.com/repos/matrix-org/matrix-rust-sdk-crypto-nodejs/zipball/v0.4.0' ,
214+ assets : [
215+ {
216+ name : 'matrix-sdk-crypto.linux-x64-gnu.node' ,
217+ size : 22_027_000 ,
218+ updated_at : '2026-01-16T01:31:27Z' ,
219+ browser_download_url :
220+ 'https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/download/v0.4.0/matrix-sdk-crypto.linux-x64-gnu.node' ,
221+ } ,
222+ {
223+ name : 'matrix-sdk-crypto.win32-x64-msvc.node' ,
224+ size : 15_202_816 ,
225+ updated_at : '2026-01-16T01:37:41Z' ,
226+ browser_download_url :
227+ 'https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/download/v0.4.0/matrix-sdk-crypto.win32-x64-msvc.node' ,
228+ } ,
229+ ] ,
230+ } ,
231+ ] ,
232+ status : 200 ,
233+ } ,
234+ ) ;
235+ let result = await binary . fetch ( '/' , '@matrix-org/matrix-sdk-crypto-nodejs' ) ;
236+ assert . ok ( result ) ;
237+ assert . ok ( result . items . length > 0 ) ;
238+ let matchDir = false ;
239+ for ( const item of result . items ) {
240+ assert . ok ( item . isDir === true ) ;
241+ if ( item . name === 'v0.4.0/' ) {
242+ assert . equal ( item . date , '2026-01-16T01:50:49Z' ) ;
243+ assert . equal ( item . size , '-' ) ;
244+ matchDir = true ;
245+ }
246+ }
247+ assert . ok ( matchDir ) ;
248+
249+ result = await binary . fetch ( '/v0.4.0/' , '@matrix-org/matrix-sdk-crypto-nodejs' ) ;
250+ assert . ok ( result ) ;
251+ assert . ok ( result . items . length > 0 ) ;
252+ let matchFile1 = false ;
253+ let matchFile2 = false ;
254+ let matchFile3 = false ;
255+ for ( const item of result . items ) {
256+ assert . ok ( item . isDir === false ) ;
257+ if ( item . name === 'matrix-sdk-crypto.linux-x64-gnu.node' ) {
258+ assert . equal ( item . date , '2026-01-16T01:31:27Z' ) ;
259+ assert . equal ( item . size , 22_027_000 ) ;
260+ assert . equal (
261+ item . url ,
262+ 'https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/download/v0.4.0/matrix-sdk-crypto.linux-x64-gnu.node' ,
263+ ) ;
264+ matchFile1 = true ;
265+ }
266+ if ( item . name === 'matrix-sdk-crypto.win32-x64-msvc.node' ) {
267+ assert . equal ( item . date , '2026-01-16T01:37:41Z' ) ;
268+ assert . equal ( item . size , 15_202_816 ) ;
269+ assert . equal (
270+ item . url ,
271+ 'https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/releases/download/v0.4.0/matrix-sdk-crypto.win32-x64-msvc.node' ,
272+ ) ;
273+ matchFile2 = true ;
274+ }
275+ if ( item . name === 'v0.4.0.tar.gz' ) {
276+ assert . equal ( item . url , 'https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs/archive/v0.4.0.tar.gz' ) ;
277+ matchFile3 = true ;
278+ }
279+ }
280+ assert . ok ( matchFile1 ) ;
281+ assert . ok ( matchFile2 ) ;
282+ assert . ok ( matchFile3 ) ;
283+ } ) ;
284+
105285 it ( 'should fetch protobuf' , async ( ) => {
106286 const response = await TestUtil . readJSONFile ( TestUtil . getFixtures ( 'protobuf-releases.json' ) ) ;
107287 app . mockHttpclient ( / h t t p s : \/ \/ a p i \. g i t h u b \. c o m \/ r e p o s \/ p r o t o c o l b u f f e r s \/ p r o t o b u f \/ r e l e a s e s / , 'GET' , {
0 commit comments