ueberdb2 4.0.17 → 4.1.2

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.
Files changed (44) hide show
  1. package/package.json +4 -1
  2. package/.eslintignore +0 -2
  3. package/.eslintrc.cjs +0 -66
  4. package/.github/dependabot.yml +0 -11
  5. package/.github/workflows/npmpublish.yml +0 -134
  6. package/.travis.yml +0 -46
  7. package/CHANGELOG.md +0 -304
  8. package/CONTRIBUTING.md +0 -103
  9. package/SECURITY.md +0 -5
  10. package/databases/cassandra_db.ts +0 -265
  11. package/databases/couch_db.ts +0 -189
  12. package/databases/dirty_db.ts +0 -85
  13. package/databases/dirty_git_db.ts +0 -82
  14. package/databases/elasticsearch_db.ts +0 -257
  15. package/databases/memory_db.ts +0 -41
  16. package/databases/mock_db.ts +0 -43
  17. package/databases/mongodb_db.ts +0 -142
  18. package/databases/mssql_db.ts +0 -226
  19. package/databases/mysql_db.ts +0 -183
  20. package/databases/postgres_db.ts +0 -213
  21. package/databases/postgrespool_db.ts +0 -11
  22. package/databases/redis_db.ts +0 -129
  23. package/databases/rethink_db.ts +0 -114
  24. package/databases/sqlite_db.ts +0 -159
  25. package/docker-compose.yml +0 -44
  26. package/index.ts +0 -224
  27. package/lib/AbstractDatabase.ts +0 -79
  28. package/lib/CacheAndBufferLayer.ts +0 -665
  29. package/lib/logging.ts +0 -33
  30. package/test/lib/databases.ts +0 -73
  31. package/test/lib/mysql.sql +0 -84
  32. package/test/test.ts +0 -328
  33. package/test/test_bulk.ts +0 -69
  34. package/test/test_elasticsearch.ts +0 -128
  35. package/test/test_findKeys.ts +0 -41
  36. package/test/test_flush.ts +0 -55
  37. package/test/test_getSub.ts +0 -28
  38. package/test/test_lru.ts +0 -151
  39. package/test/test_memory.ts +0 -32
  40. package/test/test_metrics.ts +0 -734
  41. package/test/test_mysql.ts +0 -62
  42. package/test/test_postgres.ts +0 -16
  43. package/test/test_setSub.ts +0 -19
  44. package/test/test_tojson.ts +0 -34
package/test/test_bulk.ts DELETED
@@ -1,69 +0,0 @@
1
- import assert$0 from 'assert';
2
- import {Database} from '../index';
3
- import util from 'util';
4
- 'use strict';
5
- const assert = assert$0.strict;
6
- const range = (N: any) => [...Array(N).keys()];
7
- describe(__filename, () => {
8
- let db: any = null;
9
- let mock: any = null;
10
- const createDb = async (wrapperSettings: any) => {
11
- const settings = {};
12
- db = new Database('mock', settings, wrapperSettings);
13
- // @ts-expect-error TS(2339): Property 'mock' does not exist on type '{}'.
14
- mock = settings.mock;
15
- mock.once('init', (cb: any) => cb());
16
- await db.init();
17
- };
18
- afterEach(async () => {
19
- if (mock != null) {
20
- mock.removeAllListeners();
21
- mock.once('close', (cb: any) => cb());
22
- mock = null;
23
- }
24
- if (db != null) {
25
- await db.close();
26
- db = null;
27
- }
28
- });
29
- describe('bulkLimit', () => {
30
- const bulkLimits = [0, false, null, undefined, '', 1, 2];
31
- for (const bulkLimit of bulkLimits) {
32
- it(bulkLimit === undefined ? 'undefined' : JSON.stringify(bulkLimit), async () => {
33
- await createDb({bulkLimit});
34
- const gotWrites: any = [];
35
- mock.on('set', util.callbackify(async (k: any, v: any) => gotWrites.push(1)));
36
- mock.on('doBulk', util.callbackify(async (ops: any) => gotWrites.push(ops.length)));
37
- const N = 10;
38
- await Promise.all(range(N).map((i) => db.set(`key${i}`, `val${i}`)));
39
- const wantLimit = bulkLimit || N;
40
- // @ts-expect-error TS(2363): The right-hand side of an arithmetic operation mus... Remove this comment to see the full error message
41
- const wantWrites = range(N / wantLimit).map((i) => wantLimit);
42
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
43
- assert.deepEqual(gotWrites, wantWrites);
44
- });
45
- }
46
- });
47
- it('bulk failures are retried individually', async () => {
48
- await createDb({});
49
- const gotDoBulkCalls: any = [];
50
- mock.on('doBulk', util.callbackify(async (ops: any) => {
51
- gotDoBulkCalls.push(ops.length);
52
- throw new Error('test');
53
- }));
54
- const gotWrites = new Map();
55
- const wantWrites = new Map();
56
- mock.on('set', util.callbackify(async (k: any, v: any) => gotWrites.set(k, v)));
57
- const N = 10;
58
- await Promise.all(range(N).map(async (i) => {
59
- const k = `key${i}`;
60
- const v = `val${i}`;
61
- wantWrites.set(k, JSON.stringify(v));
62
- await db.set(k, v);
63
- }));
64
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
65
- assert.deepEqual(gotDoBulkCalls, [N]);
66
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
67
- assert.deepEqual(gotWrites, wantWrites);
68
- });
69
- });
@@ -1,128 +0,0 @@
1
- import {deepEqual, rejects} from 'assert';
2
- import es from 'elasticsearch7';
3
- import {databases} from './lib/databases';
4
- import logging from '../lib/logging';
5
- import * as ueberdb from '../index';
6
- 'use strict';
7
- const {databases: {elasticsearch: cfg}} = {databases};
8
- const logger = new class extends logging.ConsoleLogger {
9
- info() { }
10
- isInfoEnabled() { return false; }
11
- }();
12
-
13
- describe(__filename, function (this: any) {
14
- this.timeout(60000);
15
- const {base_index = 'ueberdb_test'} = cfg;
16
- let client: any;
17
- let db: any;
18
- beforeEach(async () => {
19
- client = new es.Client({
20
- node: `http://${cfg.host || '127.0.0.1'}:${cfg.port || '9200'}`,
21
- });
22
- await client.indices.delete({index: `${base_index}*`}, {ignore: [404]});
23
- });
24
- afterEach(async () => {
25
- if (db != null) { await db.close(); }
26
- db = null;
27
- await client.indices.delete({index: `${base_index}*`}, {ignore: [404]});
28
- client.close();
29
- client = null;
30
- });
31
- describe('migration to schema v2', () => {
32
- describe('no old data', () => {
33
- for (const migrate of [false, true]) {
34
- it(`migration ${migrate ? 'en' : 'dis'}abled`, async () => {
35
- // @ts-ignore
36
- const settings = {base_index, migrate_to_newer_schema: undefined,
37
- ...cfg};
38
- delete settings.migrate_to_newer_schema;
39
- db = new ueberdb.Database('elasticsearch', settings, {}, logger);
40
- await db.init();
41
- const indices = [];
42
- const {body: res} = await client.indices.get({index: `${base_index}*`});
43
- for (const [k, v] of Object.entries(res)) {
44
- indices.push(k);
45
- // @ts-expect-error TS(2571): Object is of type 'unknown'.
46
- indices.push(...Object.keys(v.aliases));
47
- }
48
- deepEqual(indices.sort(), [`${base_index}_s2`, `${base_index}_s2_i0`].sort());
49
- });
50
- }
51
- });
52
- describe('existing data', () => {
53
- // @ts-expect-error TS(2769): No overload matches this call.
54
- const data = new Map([
55
- ['foo:number', 42],
56
- ['foo:string', 'value'],
57
- ['foo:object', {k: 'v'}],
58
- ['foo:p:s:number', 42],
59
- ['foo:p:s:string', 'value'],
60
- ['foo:p:s:object', {k: 'v'}],
61
- ]);
62
- const setOld = async (k: any, v: any) => {
63
- const kp = k.split(':');
64
- const index = kp.length === 4 ? `${base_index}-${kp[0]}-${kp[2]}` : base_index;
65
- await client.index({
66
- index,
67
- type: kp.length === 4 ? encodeURIComponent(kp[1]) : kp[0],
68
- id: kp.length === 4 ? kp[3] : encodeURIComponent(kp[1]),
69
- body: {
70
- // The old elasticsearch driver was inconsistent: doBulk() called JSON.parse() on the
71
- // value from ueberdb before writing, but set() did not. We'll assume that any existing
72
- // data came from set() writes, not doBulk() writes.
73
- val: JSON.stringify(v),
74
- },
75
- });
76
- await client.indices.refresh({index});
77
- };
78
- beforeEach(async () => {
79
- await Promise.all([...data].map(async ([k, v]) => await setOld(k, v)));
80
- });
81
- it('migration disabled => init error', async () => {
82
- // @ts-ignore
83
- const settings = {base_index, migrate_to_newer_schema: undefined,
84
- ...cfg};
85
- delete settings.migrate_to_newer_schema;
86
- db = new ueberdb.Database('elasticsearch', settings, {}, logger);
87
- await rejects(db.init(), /migrate_to_newer_schema/);
88
- });
89
- it('migration enabled', async () => {
90
- // @ts-ignore
91
- const settings = {base_index, ...cfg, migrate_to_newer_schema: true};
92
- db = new ueberdb.Database('elasticsearch', settings, {}, logger);
93
- await db.init();
94
- await Promise.all([...data].map(async ([k, v]) => {
95
- deepEqual(await db.get(k), v);
96
- }));
97
- });
98
- it('each attempt uses a new index', async () => {
99
- await setOld('a-x:b:c-x:d', 'v'); // Force a conversion failure.
100
- cfg.base_index = base_index;
101
- const settings = {...cfg, migrate_to_newer_schema: true};
102
- db = new ueberdb.Database('elasticsearch', settings, {}, logger);
103
- const getIndices = async () => Object.keys((await client.indices.get({index: `${base_index}_s2*`})).body);
104
- deepEqual(await getIndices(), []);
105
- await rejects(db.init(), /ambig/);
106
- deepEqual(await getIndices(), [`${base_index}_s2_migrate_attempt_0`]);
107
- await rejects(db.init(), /ambig/);
108
- deepEqual((await getIndices()).sort(), [
109
- `${base_index}_s2_migrate_attempt_0`,
110
- `${base_index}_s2_migrate_attempt_1`,
111
- ]);
112
- });
113
- it('final name not created until success', async () => {
114
- });
115
- describe('ambiguous key', () => {
116
- for (const k of ['a:b:c-x:d', 'a-x:b:c:d', 'a-x:b:c-x:d']) {
117
- it(k, async () => {
118
- await setOld(k, 'v');
119
- cfg.base_index = base_index;
120
- const settings = {...cfg, migrate_to_newer_schema: true};
121
- db = new ueberdb.Database('elasticsearch', settings, {}, logger);
122
- await rejects(db.init(), /ambig/);
123
- });
124
- }
125
- });
126
- });
127
- });
128
- });
@@ -1,41 +0,0 @@
1
- import assert$0 from 'assert';
2
- import logging from '../lib/logging';
3
- import * as ueberdb from '../index';
4
- 'use strict';
5
- const assert = assert$0.strict;
6
- const logger = new logging.ConsoleLogger();
7
- describe(__filename, () => {
8
- let db: any = null;
9
- let mock: any = null;
10
- const createDb = async (wrapperSettings = {}) => {
11
- const settings = {};
12
- db = new ueberdb.Database('mock', settings, {json: false, ...wrapperSettings}, logger);
13
- // @ts-expect-error TS(2339): Property 'mock' does not exist on type '{}'.
14
- mock = settings.mock;
15
- mock.once('init', (cb: any) => cb());
16
- await db.init();
17
- };
18
- afterEach(async () => {
19
- if (mock != null) {
20
- mock.removeAllListeners();
21
- mock.once('close', (cb: any) => cb());
22
- mock = null;
23
- }
24
- if (db != null) {
25
- await db.close();
26
- db = null;
27
- }
28
- });
29
- it('cached entries are flushed before calling findKeys', async () => {
30
- // Trigger a test timeout if flush() completes before the write operation is buffered.
31
- await createDb({writeInterval: 1e9});
32
- let called = false;
33
- mock.on('set', (k: any, v: any, cb: any) => { called = true; cb(null); });
34
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
35
- mock.on('findKeys', (k: any, nk: any, cb: any) => { assert(called); cb(null, []); });
36
- await Promise.all([
37
- db.set('key', 'value'),
38
- db.findKeys('key', null),
39
- ]);
40
- });
41
- });
@@ -1,55 +0,0 @@
1
- import logging from '../lib/logging';
2
- import * as ueberdb from '../index';
3
- 'use strict';
4
- const logger = new logging.ConsoleLogger();
5
- describe(__filename, () => {
6
- let db: any = null;
7
- let mock: any = null;
8
- const createDb = async (wrapperSettings = {}) => {
9
- const settings = {};
10
- db = new ueberdb.Database('mock', settings, {json: false, ...wrapperSettings}, logger);
11
- // @ts-expect-error TS(2339): Property 'mock' does not exist on type '{}'.
12
- mock = settings.mock;
13
- mock.once('init', (cb: any) => cb());
14
- await db.init();
15
- };
16
- afterEach(async () => {
17
- if (mock != null) {
18
- mock.removeAllListeners();
19
- mock.once('close', (cb: any) => cb());
20
- mock = null;
21
- }
22
- if (db != null) {
23
- await db.close();
24
- db = null;
25
- }
26
- });
27
- it('flush() immediately after set() sees the write operation', async () => {
28
- // Trigger a test timeout if flush() completes before the write operation is buffered.
29
- await createDb({writeInterval: 1e9});
30
- mock.on('set', (k: any, v: any, cb: any) => cb());
31
- await Promise.all([
32
- db.set('key', 'value'),
33
- db.flush(),
34
- ]);
35
- });
36
- it('flush() immediately after setSub() sees the write operation', async () => {
37
- // Trigger a test timeout if flush() completes before the write operation is buffered.
38
- await createDb({writeInterval: 1e9});
39
- mock.on('get', (k: any, cb: any) => cb(null, {sub: 'oldvalue'}));
40
- mock.on('set', (k: any, v: any, cb: any) => cb(null));
41
- await Promise.all([
42
- db.setSub('key', ['sub'], 'newvalue'),
43
- db.flush(),
44
- ]);
45
- });
46
- it('flush() immediately after remove() sees the write operation', async () => {
47
- // Trigger a test timeout if flush() completes before the write operation is buffered.
48
- await createDb({writeInterval: 1e9});
49
- mock.on('remove', (k: any, cb: any) => cb(null));
50
- await Promise.all([
51
- db.remove('key'),
52
- db.flush(),
53
- ]);
54
- });
55
- });
@@ -1,28 +0,0 @@
1
- import assert$0 from 'assert';
2
- import * as ueberdb from '../index';
3
- 'use strict';
4
- const assert = assert$0.strict;
5
- describe(__filename, () => {
6
- let db: any;
7
- beforeEach(async () => {
8
- db = new ueberdb.Database('memory', {}, {});
9
- await db.init();
10
- await db.set('k', {s: 'v'});
11
- });
12
- afterEach(async () => {
13
- if (db != null) await db.close();
14
- db = null;
15
- });
16
- it('getSub stops at non-objects', async () => {
17
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
18
- assert((await db.getSub('k', ['s', 'length'])) == null);
19
- });
20
- it('getSub ignores non-own properties', async () => {
21
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
22
- assert((await db.getSub('k', ['toString'])) == null);
23
- });
24
- it('getSub ignores __proto__', async () => {
25
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
26
- assert((await db.getSub('k', ['__proto__'])) == null);
27
- });
28
- });
package/test/test_lru.ts DELETED
@@ -1,151 +0,0 @@
1
- // @ts-expect-error TS(2306): File '/mnt/c/Users/samue/WebstormProjects/ueberDB/... Remove this comment to see the full error message
2
- import {exportedForTesting} from '../lib/CacheAndBufferLayer';
3
- import assert$0 from 'assert';
4
- 'use strict';
5
- const LRU = {exportedForTesting}.exportedForTesting.LRU;
6
- const assert = assert$0.strict;
7
- describe(__filename, () => {
8
- describe('capacity = 0', () => {
9
- it('constructor does not throw', async () => {
10
- new LRU(0);
11
- });
12
- describe('behavior when empty', () => {
13
- it('get() returns nullish', async () => {
14
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
15
- assert((new LRU(0)).get('k') == null);
16
- });
17
- it('empty iteration', async () => {
18
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
19
- assert.equal([...(new LRU(0))].length, 0);
20
- });
21
- it('evictOld() does not throw', async () => {
22
- (new LRU(0)).evictOld();
23
- });
24
- });
25
- describe('single entry with evictable = false', () => {
26
- let evictable: any, lru: any, key: any, val: any;
27
- beforeEach(async () => {
28
- evictable = false;
29
- lru = new LRU(0, () => evictable);
30
- key = 'k';
31
- val = 'v';
32
- lru.set(key, val);
33
- });
34
- it('get() works', async () => {
35
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
36
- assert.equal(lru.get(key), val);
37
- });
38
- it('iterate works', async () => {
39
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
40
- assert.deepEqual([...lru], [[key, val]]);
41
- });
42
- it('re-set() works', async () => {
43
- const val2 = 'v2';
44
- lru.set(key, val2);
45
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
46
- assert.equal(lru.get(key), val2);
47
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
48
- assert.deepEqual([...lru], [[key, val2]]);
49
- });
50
- it('evictOld() does not evict', async () => {
51
- lru.evictOld();
52
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
53
- assert.deepEqual([...lru], [[key, val]]);
54
- });
55
- it('evictOld() evicts after setting evictable = true', async () => {
56
- evictable = true;
57
- lru.evictOld();
58
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
59
- assert.deepEqual([...lru], []);
60
- });
61
- });
62
- describe('set immediately evicts if evictable', () => {
63
- it('explicitly evictable', async () => {
64
- const lru = new LRU(0, () => true);
65
- lru.set('k', 'v');
66
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
67
- assert(lru.get('k') == null);
68
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
69
- assert.deepEqual([...lru], []);
70
- });
71
-
72
- it('is evictable by default', async () => {
73
- const lru = new LRU(0);
74
- lru.set('k', 'v');
75
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
76
- assert(lru.get('k') == null);
77
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
78
- assert.deepEqual([...lru], []);
79
- });
80
- });
81
- });
82
- describe('capacity = 2', () => {
83
- let evictable: any, lru: any;
84
- beforeEach(async () => {
85
- evictable = () => false;
86
- lru = new LRU(2, (k: any, v: any) => evictable(k, v));
87
- });
88
- it('iterates oldest first', async () => {
89
- lru.set(0, '0');
90
- lru.set(1, '1');
91
- let i = 0;
92
- for (const [k, v] of lru) {
93
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
94
- assert.equal(k, i);
95
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
96
- assert.equal(v, `${i}`);
97
- i++;
98
- }
99
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
100
- assert.equal(i, 2);
101
- });
102
- it('get(k) updates recently used', async () => {
103
- lru.set(0, '0');
104
- lru.set(1, '1');
105
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
106
- assert.equal(lru.get(0), '0');
107
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
108
- assert.deepEqual([...lru], [[1, '1'], [0, '0']]);
109
- });
110
- it('get(k, false) does not update recently used', async () => {
111
- lru.set(0, '0');
112
- lru.set(1, '1');
113
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
114
- assert.equal(lru.get(0, false), '0');
115
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
116
- assert.deepEqual([...lru], [[0, '0'], [1, '1']]);
117
- });
118
- it('re-set() updates recently used', async () => {
119
- lru.set(0, '0');
120
- lru.set(1, '1');
121
- lru.set(0, '00');
122
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
123
- assert.deepEqual([...lru], [[1, '1'], [0, '00']]);
124
- });
125
- it('evictOld() only evicts evictable entries', async () => {
126
- evictable = () => false;
127
- lru.set(0, '0');
128
- lru.set(1, '1');
129
- lru.set(2, '2');
130
- lru.set(3, '3');
131
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
132
- assert.deepEqual([...lru], [[0, '0'], [1, '1'], [2, '2'], [3, '3']]);
133
- evictable = (k: any) => k >= 2;
134
- lru.evictOld();
135
- // The newer entries should be evicted because the older are dirty/writingInProgress.
136
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
137
- assert.deepEqual([...lru], [[0, '0'], [1, '1']]);
138
- });
139
- it('evictOld() does nothing if at or below capacity', async () => {
140
- evictable = () => true;
141
- lru.set(0, '0');
142
- lru.evictOld();
143
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
144
- assert.deepEqual([...lru], [[0, '0']]);
145
- lru.set(1, '1');
146
- lru.evictOld();
147
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
148
- assert.deepEqual([...lru], [[0, '0'], [1, '1']]);
149
- });
150
- });
151
- });
@@ -1,32 +0,0 @@
1
- import assert$0 from 'assert';
2
- import * as memory from '../databases/memory_db';
3
- 'use strict';
4
- const assert = assert$0.strict;
5
-
6
- describe(__filename, () => {
7
- describe('data option', () => {
8
- it('uses existing records from data option', async () => {
9
- const db = new memory.Database({data: new Map([['foo', 'bar']])});
10
- await db.init();
11
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
12
- assert.equal(await db.get('foo'), 'bar');
13
- });
14
- it('updates existing map', async () => {
15
- const data = new Map();
16
- const db = new memory.Database({data});
17
- await db.init();
18
- await db.set('foo', 'bar');
19
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
20
- assert.equal(data.get('foo'), 'bar');
21
- });
22
- it('does not clear map on close', async () => {
23
- const data = new Map();
24
- const db = new memory.Database({data});
25
- await db.init();
26
- await db.set('foo', 'bar');
27
- await db.close();
28
- // @ts-expect-error TS(2775): Assertions require every name in the call target t... Remove this comment to see the full error message
29
- assert.equal(data.get('foo'), 'bar');
30
- });
31
- });
32
- });