diff options
Diffstat (limited to 'test/cache-map.test.js')
| -rw-r--r-- | test/cache-map.test.js | 12 | 
1 files changed, 8 insertions, 4 deletions
| diff --git a/test/cache-map.test.js b/test/cache-map.test.js index 9d10a719..3e7def1f 100644 --- a/test/cache-map.test.js +++ b/test/cache-map.test.js @@ -19,6 +19,7 @@  import {expect, test} from 'vitest';  import {CacheMap} from '../ext/js/general/cache-map.js'; +/** */  function testConstructor() {      test('constructor', () => {          const data = [ @@ -29,6 +30,7 @@ function testConstructor() {              [true,  () => new CacheMap(1.5)],              [true,  () => new CacheMap(Number.NaN)],              [true,  () => new CacheMap(Number.POSITIVE_INFINITY)], +            // @ts-ignore - Ignore because it should throw an error              [true,  () => new CacheMap('a')]          ]; @@ -42,6 +44,7 @@ function testConstructor() {      });  } +/** */  function testApi() {      test('api', () => {          const data = [ @@ -103,10 +106,10 @@ function testApi() {                  const {func, args} = call;                  let returnValue;                  switch (func) { -                    case 'get': returnValue = cache.get(...args); break; -                    case 'set': returnValue = cache.set(...args); break; -                    case 'has': returnValue = cache.has(...args); break; -                    case 'clear': returnValue = cache.clear(...args); break; +                    case 'get': returnValue = cache.get(args[0]); break; +                    case 'set': returnValue = cache.set(args[0], args[1]); break; +                    case 'has': returnValue = cache.has(args[0]); break; +                    case 'clear': returnValue = cache.clear(); break;                  }                  if (Object.prototype.hasOwnProperty.call(call, 'returnValue')) {                      const {returnValue: expectedReturnValue} = call; @@ -119,6 +122,7 @@ function testApi() {  } +/** */  function main() {      testConstructor();      testApi(); |