@toa.io/extensions.origins 0.20.0-dev.12 → 0.20.0-dev.14
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/extensions.origins",
|
|
3
|
-
"version": "0.20.0-dev.
|
|
3
|
+
"version": "0.20.0-dev.14",
|
|
4
4
|
"description": "Toa Origins",
|
|
5
5
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
6
6
|
"homepage": "https://github.com/toa-io/toa#readme",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@toa.io/core": "0.20.0-dev.
|
|
23
|
-
"@toa.io/generic": "0.20.0-dev.
|
|
24
|
-
"@toa.io/schemas": "0.20.0-dev.
|
|
25
|
-
"@toa.io/yaml": "0.20.0-dev.
|
|
26
|
-
"comq": "0.
|
|
22
|
+
"@toa.io/core": "0.20.0-dev.14",
|
|
23
|
+
"@toa.io/generic": "0.20.0-dev.14",
|
|
24
|
+
"@toa.io/schemas": "0.20.0-dev.14",
|
|
25
|
+
"@toa.io/yaml": "0.20.0-dev.14",
|
|
26
|
+
"comq": "0.8.0",
|
|
27
27
|
"node-fetch": "2.6.7"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node-fetch": "2.6.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "bb2aed156c9e6b76bb802628bb249d4dd7adcebe"
|
|
33
33
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const { generate } = require('randomstring')
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const assert = jest.fn(async () => ({
|
|
6
6
|
emit: jest.fn(async () => undefined),
|
|
7
7
|
request: jest.fn(async () => generate()),
|
|
8
8
|
reply: jest.fn(async () => undefined),
|
|
@@ -10,4 +10,4 @@ const connect = jest.fn(async () => ({
|
|
|
10
10
|
close: jest.fn(async () => undefined)
|
|
11
11
|
}))
|
|
12
12
|
|
|
13
|
-
exports.
|
|
13
|
+
exports.assert = assert
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { assert } = require('comq')
|
|
4
4
|
const { Connector } = require('@toa.io/core')
|
|
5
5
|
const { shards } = require('@toa.io/generic')
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ class Aspect extends Connector {
|
|
|
44
44
|
|
|
45
45
|
#open = async ([origin, reference]) => {
|
|
46
46
|
const references = shards(reference)
|
|
47
|
-
const io = await
|
|
47
|
+
const io = await assert(...references)
|
|
48
48
|
|
|
49
49
|
this.#origins[origin] = restrict(io)
|
|
50
50
|
}
|
|
@@ -41,7 +41,7 @@ it('should connect', async () => {
|
|
|
41
41
|
await aspect.open()
|
|
42
42
|
|
|
43
43
|
for (const reference of Object.values(manifest)) {
|
|
44
|
-
expect(comq.
|
|
44
|
+
expect(comq.assert).toHaveBeenCalledWith(reference)
|
|
45
45
|
}
|
|
46
46
|
})
|
|
47
47
|
|
|
@@ -60,7 +60,7 @@ it('should connect to shards', async () => {
|
|
|
60
60
|
|
|
61
61
|
await aspect.open()
|
|
62
62
|
|
|
63
|
-
expect(comq.
|
|
63
|
+
expect(comq.assert).toHaveBeenCalledWith(...shards)
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
it('should disconnect', async () => {
|
|
@@ -68,8 +68,8 @@ it('should disconnect', async () => {
|
|
|
68
68
|
await aspect.close()
|
|
69
69
|
|
|
70
70
|
for (const reference of Object.values(manifest)) {
|
|
71
|
-
const index = comq.
|
|
72
|
-
const io = await comq.
|
|
71
|
+
const index = comq.assert.mock.calls.findIndex((call) => call[0] === reference)
|
|
72
|
+
const io = await comq.assert.mock.results[index].value
|
|
73
73
|
|
|
74
74
|
expect(io.close).toHaveBeenCalled()
|
|
75
75
|
}
|
|
@@ -92,9 +92,9 @@ describe('invoke', () => {
|
|
|
92
92
|
origin = sample(origins)
|
|
93
93
|
|
|
94
94
|
const reference = manifest[origin]
|
|
95
|
-
const index = comq.
|
|
95
|
+
const index = comq.assert.mock.calls.findIndex((call) => call[0] === reference)
|
|
96
96
|
|
|
97
|
-
io = await comq.
|
|
97
|
+
io = await comq.assert.mock.results[index].value
|
|
98
98
|
args = [generate(), generate(), generate()]
|
|
99
99
|
})
|
|
100
100
|
|