@superhero/eventflow-db 4.0.4 → 4.0.5
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/index.js +16 -2
- package/index.test.js +6 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -28,9 +28,23 @@ export default class DB
|
|
|
28
28
|
this.gateway = gateway
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
destroy()
|
|
32
32
|
{
|
|
33
|
-
|
|
33
|
+
return new Promise((resolve, reject) =>
|
|
34
|
+
{
|
|
35
|
+
setImmediate(async () =>
|
|
36
|
+
{
|
|
37
|
+
try
|
|
38
|
+
{
|
|
39
|
+
await this.gateway.close()
|
|
40
|
+
resolve()
|
|
41
|
+
}
|
|
42
|
+
catch(error)
|
|
43
|
+
{
|
|
44
|
+
reject(error)
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
})
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
async createTableCertificate()
|
package/index.test.js
CHANGED
|
@@ -36,11 +36,12 @@ suite('@superhero/eventflow-db', async () =>
|
|
|
36
36
|
{
|
|
37
37
|
const hubs = await db.readOnlineHubs()
|
|
38
38
|
assert.ok(hubs.length > 0, 'Online hubs should be returned')
|
|
39
|
-
|
|
40
|
-
assert.equal(
|
|
41
|
-
assert.equal(
|
|
42
|
-
assert.equal(
|
|
43
|
-
assert.equal(
|
|
39
|
+
const onlineHub = hubs[hubs.length - 1]
|
|
40
|
+
assert.equal(onlineHub.id, hub.id)
|
|
41
|
+
assert.equal(onlineHub.external_ip, hub.external_ip)
|
|
42
|
+
assert.equal(onlineHub.internal_ip, hub.internal_ip)
|
|
43
|
+
assert.equal(onlineHub.external_port, hub.external_port)
|
|
44
|
+
assert.equal(onlineHub.internal_port, hub.internal_port)
|
|
44
45
|
})
|
|
45
46
|
|
|
46
47
|
await sub.test('Persisting an event should generate an ID if not provided', async (sub) =>
|