@@ -2,24 +2,23 @@ import assert from 'node:assert';
2
2
import test from 'node:test' ;
3
3
import pickBestIcon from './icons.js' ;
4
4
5
- globalThis . devicePixelRatio = 1 ;
6
-
7
5
const manifest = [
8
6
{ url : '16.svg' , size : 16 } ,
9
7
{ url : '32.svg' , size : 32 } ,
10
8
] ;
11
9
12
10
test ( 'pickBestIcon' , ( ) => {
11
+ globalThis . devicePixelRatio = 1 ;
13
12
assert . equal ( pickBestIcon ( ) , 'icons/puzzle.svg' ) ;
14
13
assert . equal ( pickBestIcon ( undefined ) , 'icons/puzzle.svg' ) ;
15
14
assert . equal ( pickBestIcon ( [ ] ) , 'icons/puzzle.svg' ) ;
16
- // assert.equal(pickBestIcon(manifest), '16.svg');
17
- // assert.equal(pickBestIcon(manifest, 16), '16.svg');
18
- // assert.equal(pickBestIcon(manifest, 1), '16.svg');
19
- // assert.equal(pickBestIcon(manifest, 32), '32.svg');
15
+ assert . equal ( pickBestIcon ( manifest ) , '16.svg' ) ;
16
+ assert . equal ( pickBestIcon ( manifest , 16 ) , '16.svg' ) ;
17
+ assert . equal ( pickBestIcon ( manifest , 1 ) , '16.svg' ) ;
18
+ assert . equal ( pickBestIcon ( manifest , 32 ) , '32.svg' ) ;
20
19
assert . equal ( pickBestIcon ( manifest , 48 ) , '32.svg' ) ;
21
20
22
- // globalThis.devicePixelRatio = 2;
23
- // assert.equal(pickBestIcon(manifest, 16), '32.svg');
24
- // assert.equal(pickBestIcon(manifest, 32), '64 .svg');
21
+ globalThis . devicePixelRatio = 2 ;
22
+ assert . equal ( pickBestIcon ( manifest , 16 ) , '32.svg' ) ;
23
+ assert . equal ( pickBestIcon ( manifest , 32 ) , '32 .svg' ) ;
25
24
} ) ;
0 commit comments