1- /* eslint-disable unicorn/no-array-for-each, no-warning-comments -- It's part of the test */
1+ /* eslint-disable unicorn/no-array-for-each, no-warning-comments, @typescript-eslint/no-empty-function -- It's part of the test */
22import { test , assert } from 'vitest' ;
33import ManyKeysMap from './index.js' ;
44
55// AVA adapter
6- const t = {
6+ const t : {
7+ // TS complains https://stackoverflow.com/a/72689922/288906
8+ is : typeof assert . equal ;
9+ deepEqual : typeof assert . deepEqual ;
10+ true : typeof assert . isTrue ;
11+ false : typeof assert . isFalse ;
12+ throws : typeof assert . throws ;
13+ } = {
714 is : assert . equal ,
815 deepEqual : assert . deepEqual ,
916 true : assert . isTrue ,
@@ -23,7 +30,7 @@ test('Basics', () => {
2330 t . deepEqual ( [ ...map . entries ( ) ] , [ ] ) ;
2431 t . deepEqual ( [ ...map . values ( ) ] , [ ] ) ;
2532 t . deepEqual ( [ ...map . keys ( ) ] , [ ] ) ;
26- map . forEach ( _ => t . fail ( ) ) ;
33+ map . forEach ( _ => assert . fail ( ) ) ;
2734} ) ;
2835
2936test ( 'Set' , ( ) => {
@@ -42,7 +49,7 @@ test('Set', () => {
4249 t . is ( map . _publicKeys . size , 3 ) ;
4350
4451 // Also make sure that the same map is returned
45- t . is ( map . set ( [ '#' , 'fifth' ] ) , map ) ;
52+ t . is ( map . set ( [ '#' , 'fifth' ] , 5 ) , map ) ;
4653
4754 const prefilledMap = new ManyKeysMap ( [
4855 [ [ '-' ] , 'first' ] ,
@@ -152,11 +159,13 @@ test('Clear', () => {
152159 t . is ( map . _publicKeys . size , 4 ) ;
153160 t . is ( map . _symbolHashes . size , 2 ) ; // Symbol(1) and null
154161
162+ // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -- That's the test
155163 t . is ( map . clear ( ) , undefined ) ;
156164 t . is ( map . size , 0 ) ;
157165 t . is ( map . _publicKeys . size , 0 ) ;
158166 t . is ( map . _symbolHashes . size , 0 ) ;
159167
168+ // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -- That's the test
160169 t . is ( map . clear ( ) , undefined ) ;
161170 t . is ( map . size , 0 ) ;
162171 t . is ( map . _publicKeys . size , 0 ) ;
@@ -168,7 +177,7 @@ test('Iterators', () => {
168177 [ [ '-' ] , 'first' ] ,
169178 [ [ ':' , '-' ] , 'second' ] ,
170179 [ [ ':' , '-' , '%' ] , 'third' ] ,
171- ] ;
180+ ] as Array < [ unknown [ ] , string ] > ;
172181 const map = new ManyKeysMap ( pairs ) ;
173182 const regularMap = new Map ( pairs ) ;
174183
0 commit comments