@tramvai/test-mocks 4.36.2 → 4.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cache.es.js CHANGED
@@ -3,15 +3,17 @@ const createMockCache = (entries = {}) => {
3
3
  return {
4
4
  has: (key) => !!cache[key],
5
5
  get: (key) => cache[key],
6
+ peek: (key) => cache[key],
6
7
  set: (key, value) => {
7
8
  cache[key] = value;
8
9
  },
9
10
  clear: () => {
10
11
  cache = {};
11
12
  },
12
- // TODO: в @tinkoff/request- используются методы из lru-cache которых нету в Cache
13
- // @ts-ignore
14
- peek: (key) => cache[key],
13
+ delete: (key) => delete cache[key],
14
+ load: (values) => values.forEach(([key, { value }]) => (cache[key] = value)),
15
+ dump: () => Object.entries(cache).map(([key, value]) => [key, { value }]),
16
+ size: Object.keys(cache).length,
15
17
  };
16
18
  };
17
19
 
package/lib/cache.js CHANGED
@@ -7,15 +7,17 @@ const createMockCache = (entries = {}) => {
7
7
  return {
8
8
  has: (key) => !!cache[key],
9
9
  get: (key) => cache[key],
10
+ peek: (key) => cache[key],
10
11
  set: (key, value) => {
11
12
  cache[key] = value;
12
13
  },
13
14
  clear: () => {
14
15
  cache = {};
15
16
  },
16
- // TODO: в @tinkoff/request- используются методы из lru-cache которых нету в Cache
17
- // @ts-ignore
18
- peek: (key) => cache[key],
17
+ delete: (key) => delete cache[key],
18
+ load: (values) => values.forEach(([key, { value }]) => (cache[key] = value)),
19
+ dump: () => Object.entries(cache).map(([key, value]) => [key, { value }]),
20
+ size: Object.keys(cache).length,
19
21
  };
20
22
  };
21
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/test-mocks",
3
- "version": "4.36.2",
3
+ "version": "4.37.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -17,14 +17,14 @@
17
17
  "watch": "tsc -w"
18
18
  },
19
19
  "dependencies": {
20
- "@tramvai/core": "4.36.2",
20
+ "@tramvai/core": "4.37.0",
21
21
  "@tinkoff/pubsub": "0.7.1",
22
- "@tinkoff/router": "0.4.121",
22
+ "@tinkoff/router": "0.4.123",
23
23
  "@tinkoff/url": "0.10.1",
24
- "@tramvai/module-cookie": "4.36.2",
25
- "@tramvai/module-common": "4.36.2",
26
- "@tramvai/state": "4.36.2",
27
- "@tramvai/tokens-common": "4.36.2"
24
+ "@tramvai/module-cookie": "4.37.0",
25
+ "@tramvai/module-common": "4.37.0",
26
+ "@tramvai/state": "4.37.0",
27
+ "@tramvai/tokens-common": "4.37.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@tinkoff/dippy": "0.10.8",