File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
packages/snaps-controllers/src/snaps/registry Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,49 @@ describe('JsonSnapsRegistry', () => {
376376 expect ( result ) . toBe ( '1.0.0' ) ;
377377 } ) ;
378378
379+ it ( 'resolves to a compatible allowlisted version' , async ( ) => {
380+ fetchMock
381+ . mockResponseOnce (
382+ JSON . stringify ( {
383+ verifiedSnaps : {
384+ [ MOCK_SNAP_ID ] : {
385+ id : MOCK_SNAP_ID ,
386+ metadata : {
387+ name : 'Mock Snap' ,
388+ } ,
389+ versions : {
390+ [ '1.0.0' as SemVerVersion ] : {
391+ checksum : DEFAULT_SNAP_SHASUM ,
392+ } ,
393+ [ '1.1.0' as SemVerVersion ] : {
394+ checksum : DEFAULT_SNAP_SHASUM ,
395+ clientVersions : {
396+ extension : '>=15.0.0' ,
397+ } ,
398+ } ,
399+ } ,
400+ } ,
401+ } ,
402+ } ) ,
403+ )
404+ . mockResponseOnce (
405+ JSON . stringify ( {
406+ ...MOCK_SIGNATURE_FILE ,
407+ signature :
408+ '0x3045022100e17cf0f34e4d521d984ed8f8492ce8a51b65178e7ba5508e01b179c5dd013c52022025e4a4008232a883048c8174e585cd89b9054eadc37330e00fd2f07a65c9bbb4' ,
409+ } ) ,
410+ ) ;
411+
412+ const { messenger } = getRegistry ( ) ;
413+ const result = await messenger . call (
414+ 'SnapsRegistry:resolveVersion' ,
415+ MOCK_SNAP_ID ,
416+ '^1.0.0' as SemVerRange ,
417+ ) ;
418+
419+ expect ( result ) . toBe ( '1.0.0' ) ;
420+ } ) ;
421+
379422 it ( 'returns version range if snap is not on the allowlist' , async ( ) => {
380423 fetchMock
381424 . mockResponseOnce (
You can’t perform that action at this time.
0 commit comments