File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33ℹ file | line % | branch % | funcs % | uncovered lines
44ℹ ----------------------------------------------------------
55ℹ src | | | |
6- ℹ lru.js | 99.70 | 98.54 | 100.00 | 534-535
6+ ℹ lru.js | 100.00 | 99.28 | 100.00 |
77ℹ ----------------------------------------------------------
8- ℹ all files | 99.70 | 98.54 | 100.00 |
8+ ℹ all files | 100.00 | 99.28 | 100.00 |
99ℹ ----------------------------------------------------------
1010ℹ end of coverage report
Original file line number Diff line number Diff line change @@ -1292,6 +1292,17 @@ describe("LRU Cache", function () {
12921292 assert . equal ( evictedItems [ 1 ] . key , "b" ) ;
12931293 assert . equal ( evictedItems [ 2 ] . key , "c" ) ;
12941294 } ) ;
1295+
1296+ it ( "should throw TypeError if callback is not a function" , function ( ) {
1297+ assert . throws ( ( ) => cache . onEvict ( undefined ) , {
1298+ message : "onEvict callback must be a function" ,
1299+ } ) ;
1300+ assert . throws ( ( ) => cache . onEvict ( null ) , { message : "onEvict callback must be a function" } ) ;
1301+ assert . throws ( ( ) => cache . onEvict ( "not a function" ) , {
1302+ message : "onEvict callback must be a function" ,
1303+ } ) ;
1304+ assert . throws ( ( ) => cache . onEvict ( { } ) , { message : "onEvict callback must be a function" } ) ;
1305+ } ) ;
12951306 } ) ;
12961307
12971308 describe ( "sizeByTTL method" , function ( ) {
You can’t perform that action at this time.
0 commit comments