@bitfinex/bfx-facs-grc 1.2.1 → 2.0.1
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 +13 -13
- package/test/map.test.js +100 -86
- package/test/req.test.js +90 -76
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitfinex/bfx-facs-grc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Bitfinex Grenache Facility",
|
|
6
6
|
"author": {
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
"bitfinex"
|
|
13
13
|
],
|
|
14
14
|
"scripts": {
|
|
15
|
-
"lint": "
|
|
16
|
-
"lint:fix": "
|
|
15
|
+
"lint": "bfx-lint-js",
|
|
16
|
+
"lint:fix": "bfx-lint-js --fix",
|
|
17
17
|
"test": "npm run lint && npm run unit",
|
|
18
|
-
"unit": "
|
|
18
|
+
"unit": "brittle-node test/**/*.test.js"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@bitfinex/bfx-facs-base": "git+https://github.com/bitfinexcom/bfx-facs-base.git",
|
|
22
|
-
"@bitfinex/lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base#
|
|
23
|
-
"async": "3.2.6",
|
|
24
|
-
"grenache-nodejs-http": "
|
|
25
|
-
"grenache-nodejs-link": "
|
|
21
|
+
"@bitfinex/bfx-facs-base": "git+https://github.com/bitfinexcom/bfx-facs-base.git#v2.0.0",
|
|
22
|
+
"@bitfinex/lib-js-util-base": "git+https://github.com/bitfinexcom/lib-js-util-base.git#v3.0.0",
|
|
23
|
+
"async": "^3.2.6",
|
|
24
|
+
"grenache-nodejs-http": "2.0.2",
|
|
25
|
+
"grenache-nodejs-link": "2.0.2"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">=22.0"
|
|
29
29
|
},
|
|
30
30
|
"license": "Apache-2.0",
|
|
31
31
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
],
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@bitfinex/bfx-svc-test-helper": "git+https://github.com/bitfinexcom/bfx-svc-test-helper.git",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
42
|
+
"@bitfinex/bfx-svc-test-helper": "git+https://github.com/bitfinexcom/bfx-svc-test-helper.git#v2.0.2",
|
|
43
|
+
"@bitfinex/lint-js": "^1.1.0",
|
|
44
|
+
"brittle": "^4.5.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/test/map.test.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
1
|
'use strict'
|
|
4
2
|
|
|
5
|
-
const
|
|
3
|
+
const test = require('brittle')
|
|
6
4
|
const { promisify } = require('util')
|
|
7
|
-
|
|
8
5
|
const createGrapes = require('@bitfinex/bfx-svc-test-helper/grapes')
|
|
9
6
|
const createFxGrenache = require('@bitfinex/bfx-svc-test-helper/fauxgrenache')
|
|
10
|
-
|
|
11
7
|
const Fac = require('..')
|
|
12
8
|
|
|
13
9
|
const stubs = {
|
|
@@ -31,124 +27,142 @@ fac.conf = { grape: 'http://127.0.0.1:30001', transport: 'http' }
|
|
|
31
27
|
|
|
32
28
|
let fxg1
|
|
33
29
|
let fxg2
|
|
34
|
-
describe('RPC integration: map', () => {
|
|
35
|
-
before(async function () {
|
|
36
|
-
this.timeout(20000)
|
|
37
30
|
|
|
38
|
-
|
|
31
|
+
const testCase = (testBlock) => async (t) => {
|
|
32
|
+
try {
|
|
33
|
+
await before()
|
|
39
34
|
|
|
40
|
-
await
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
await testBlock(t)
|
|
36
|
+
} finally {
|
|
37
|
+
await after()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})
|
|
41
|
+
const before = async () => {
|
|
42
|
+
grapes.onAnnounce()
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
await grapes.start()
|
|
45
|
+
fxg1 = createFxGrenache(stubs, grapes, { port: 1557 })
|
|
46
|
+
fxg2 = createFxGrenache(stubs, grapes, { port: 1558 })
|
|
47
|
+
await fxg1.start()
|
|
48
|
+
await fxg2.start()
|
|
52
49
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
const start = promisify(fac.start).bind(fac)
|
|
51
|
+
await start()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const after = async () => {
|
|
55
|
+
await grapes.stop()
|
|
56
|
+
await fxg1.stop()
|
|
57
|
+
await fxg2.stop()
|
|
58
|
+
fac.stop()
|
|
59
|
+
}
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
[
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
test('RPC integration: map', testCase(async (t) => {
|
|
62
|
+
await t.test('callback', async (t) => {
|
|
63
|
+
t.test('options defaults', async (t) => {
|
|
64
|
+
await new Promise(resolve => {
|
|
65
|
+
fac.map('rest:util:net', 'getIpInfo', ['8.8.8.8'], (_err, res) => {
|
|
66
|
+
t.alike([
|
|
67
|
+
['8.8.8.8', { country: 'US', region: 'CA' }],
|
|
68
|
+
['8.8.8.8', { country: 'US', region: 'CA' }]
|
|
69
|
+
], res)
|
|
70
|
+
resolve()
|
|
71
|
+
})
|
|
67
72
|
})
|
|
68
73
|
})
|
|
69
74
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
[
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
await t.test('success', async (t) => {
|
|
76
|
+
await new Promise(resolve => {
|
|
77
|
+
fac.map('rest:util:net', 'getIpInfo', ['8.8.8.8'], {}, (_err, res) => {
|
|
78
|
+
t.alike([
|
|
79
|
+
['8.8.8.8', { country: 'US', region: 'CA' }],
|
|
80
|
+
['8.8.8.8', { country: 'US', region: 'CA' }]
|
|
81
|
+
], res)
|
|
82
|
+
resolve()
|
|
83
|
+
})
|
|
77
84
|
})
|
|
78
85
|
})
|
|
79
86
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
await t.test('lookup error', async (t) => {
|
|
88
|
+
await new Promise(resolve => {
|
|
89
|
+
fac.map('foo:test:net', 'getIpInfo', [], {}, (err) => {
|
|
90
|
+
t.is(err.message, 'ERR_GRAPE_LOOKUP_EMPTY')
|
|
91
|
+
resolve()
|
|
92
|
+
})
|
|
84
93
|
})
|
|
85
94
|
})
|
|
86
95
|
|
|
87
|
-
|
|
96
|
+
await t.test('double cb error', async (t) => {
|
|
88
97
|
const originalPeer = fac.peer
|
|
89
98
|
const originalConsoleError = console.error
|
|
90
99
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
await new Promise((resolve, reject) => {
|
|
101
|
+
let errorArgs
|
|
102
|
+
console.error = (...args) => {
|
|
103
|
+
if (errorArgs) {
|
|
104
|
+
reject(new Error('Should have been called once'))
|
|
105
|
+
}
|
|
106
|
+
errorArgs = args
|
|
95
107
|
}
|
|
96
|
-
errorArgs = args
|
|
97
|
-
}
|
|
98
108
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
fac.peer = {
|
|
110
|
+
map (service, args, opts, cb) {
|
|
111
|
+
cb()
|
|
112
|
+
cb()
|
|
113
|
+
fac.peer = originalPeer
|
|
114
|
+
console.error = originalConsoleError
|
|
115
|
+
t.is(errorArgs[0], 'ERR_DOUBLE_CB')
|
|
116
|
+
t.is(errorArgs[1], 'rest:util:net')
|
|
117
|
+
t.is(errorArgs[2], 'getIpInfo')
|
|
118
|
+
}
|
|
109
119
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
120
|
+
fac.map('rest:util:net', 'getIpInfo', [], {}, () => {
|
|
121
|
+
t.is(errorArgs, undefined)
|
|
122
|
+
resolve()
|
|
123
|
+
})
|
|
114
124
|
})
|
|
115
125
|
})
|
|
116
126
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
127
|
+
await t.test('invalid args', async (t) => {
|
|
128
|
+
await new Promise(resolve => {
|
|
129
|
+
fac.map('rest:util:net', 'getIpInfo', {}, {}, (err) => {
|
|
130
|
+
t.is(err.message, 'ERR_GRC_REQ_ARGS_INVALID')
|
|
131
|
+
resolve()
|
|
132
|
+
})
|
|
121
133
|
})
|
|
122
134
|
})
|
|
123
135
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
136
|
+
await t.test('invalid action', async (t) => {
|
|
137
|
+
await new Promise(resolve => {
|
|
138
|
+
fac.map('rest:util:net', {}, [], {}, (err) => {
|
|
139
|
+
t.is(err.message, 'ERR_GRC_REQ_ACTION_INVALID')
|
|
140
|
+
resolve()
|
|
141
|
+
})
|
|
128
142
|
})
|
|
129
143
|
})
|
|
130
144
|
})
|
|
131
145
|
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
await t.test('promise', async (t) => {
|
|
147
|
+
await t.test('success', async (t) => {
|
|
134
148
|
const res = await fac.map('rest:util:net', 'getIpInfo', ['8.8.8.8'], {})
|
|
135
|
-
|
|
149
|
+
t.alike([
|
|
136
150
|
['8.8.8.8', { country: 'US', region: 'CA' }],
|
|
137
151
|
['8.8.8.8', { country: 'US', region: 'CA' }]
|
|
138
152
|
], res)
|
|
139
153
|
})
|
|
140
154
|
|
|
141
|
-
|
|
155
|
+
await t.test('lookup error', async () => {
|
|
142
156
|
try {
|
|
143
157
|
await fac.map('foo:test:net', 'getIpInfo', [], {})
|
|
144
158
|
} catch (e) {
|
|
145
|
-
|
|
159
|
+
t.is(e.message, 'ERR_GRAPE_LOOKUP_EMPTY')
|
|
146
160
|
return
|
|
147
161
|
}
|
|
148
162
|
throw new Error('Should have thrown')
|
|
149
163
|
})
|
|
150
164
|
|
|
151
|
-
|
|
165
|
+
await t.test('double cb error', async () => {
|
|
152
166
|
const originalPeer = fac.peer
|
|
153
167
|
const originalConsoleError = console.error
|
|
154
168
|
|
|
@@ -156,9 +170,9 @@ describe('RPC integration: map', () => {
|
|
|
156
170
|
map (service, args, opts, cb) {
|
|
157
171
|
cb()
|
|
158
172
|
cb()
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
173
|
+
t.is(errorArgs[0], 'ERR_DOUBLE_CB')
|
|
174
|
+
t.is(errorArgs[1], 'rest:util:net')
|
|
175
|
+
t.is(errorArgs[2], 'getIpInfo')
|
|
162
176
|
fac.peer = originalPeer
|
|
163
177
|
console.error = originalConsoleError
|
|
164
178
|
}
|
|
@@ -175,24 +189,24 @@ describe('RPC integration: map', () => {
|
|
|
175
189
|
await fac.map('rest:util:net', 'getIpInfo', [], {})
|
|
176
190
|
})
|
|
177
191
|
|
|
178
|
-
|
|
192
|
+
await t.test('invalid args', async () => {
|
|
179
193
|
try {
|
|
180
194
|
await fac.map('rest:util:net', 'getIpInfo', {}, {})
|
|
181
195
|
} catch (e) {
|
|
182
|
-
|
|
196
|
+
t.is(e.message, 'ERR_GRC_REQ_ARGS_INVALID')
|
|
183
197
|
return
|
|
184
198
|
}
|
|
185
199
|
throw new Error('Should have thrown')
|
|
186
200
|
})
|
|
187
201
|
|
|
188
|
-
|
|
202
|
+
await t.test('invalid action', async () => {
|
|
189
203
|
try {
|
|
190
204
|
await fac.map('rest:util:net', {}, [], {})
|
|
191
205
|
} catch (e) {
|
|
192
|
-
|
|
206
|
+
t.is(e.message, 'ERR_GRC_REQ_ACTION_INVALID')
|
|
193
207
|
return
|
|
194
208
|
}
|
|
195
209
|
throw new Error('Should have thrown')
|
|
196
210
|
})
|
|
197
211
|
})
|
|
198
|
-
})
|
|
212
|
+
}))
|
package/test/req.test.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
/* eslint-env mocha */
|
|
2
|
-
|
|
3
1
|
'use strict'
|
|
4
2
|
|
|
5
|
-
const
|
|
3
|
+
const test = require('brittle')
|
|
6
4
|
const { promisify } = require('util')
|
|
7
|
-
|
|
8
5
|
const createGrapes = require('@bitfinex/bfx-svc-test-helper/grapes')
|
|
9
6
|
const createFxGrenache = require('@bitfinex/bfx-svc-test-helper/fauxgrenache')
|
|
10
|
-
|
|
11
7
|
const Fac = require('..')
|
|
12
8
|
|
|
13
9
|
const stubs = {
|
|
@@ -31,110 +27,128 @@ fac.tick = () => {}
|
|
|
31
27
|
fac.conf = { grape: 'http://127.0.0.1:30001', transport: 'http' }
|
|
32
28
|
|
|
33
29
|
let fxg
|
|
34
|
-
describe('RPC integration: req', () => {
|
|
35
|
-
before(async function () {
|
|
36
|
-
this.timeout(20000)
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
await
|
|
31
|
+
const testCase = (testBlock) => async (t) => {
|
|
32
|
+
try {
|
|
33
|
+
await before()
|
|
41
34
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
await testBlock(t)
|
|
36
|
+
} finally {
|
|
37
|
+
await after()
|
|
38
|
+
}
|
|
39
|
+
}
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
const before = async () => {
|
|
42
|
+
await grapes.start()
|
|
43
|
+
fxg = createFxGrenache(stubs, grapes)
|
|
44
|
+
await fxg.start()
|
|
48
45
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
const start = promisify(fac.start).bind(fac)
|
|
47
|
+
await start()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const after = async () => {
|
|
51
|
+
await grapes.stop()
|
|
52
|
+
await fxg.stop()
|
|
53
|
+
fac.stop()
|
|
54
|
+
}
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
test('RPC integration: req', testCase(async (t) => {
|
|
57
|
+
await t.test('callback', async (t) => {
|
|
58
|
+
await t.test('options defaults', async (t) => {
|
|
59
|
+
await new Promise(resolve => {
|
|
60
|
+
fac.req('rest:util:net', 'getIpInfo', ['8.8.8.8'], (_err, res) => {
|
|
61
|
+
t.alike(['8.8.8.8', { country: 'US', region: 'CA' }], res)
|
|
62
|
+
resolve()
|
|
63
|
+
})
|
|
59
64
|
})
|
|
60
65
|
})
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
await t.test('success', async (t) => {
|
|
68
|
+
await new Promise(resolve => {
|
|
69
|
+
fac.req('rest:util:net', 'getIpInfo', ['8.8.8.8'], {}, (_err, res) => {
|
|
70
|
+
t.alike(['8.8.8.8', { country: 'US', region: 'CA' }], res)
|
|
71
|
+
resolve()
|
|
72
|
+
})
|
|
66
73
|
})
|
|
67
74
|
})
|
|
68
75
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
await t.test('lookup error', async (t) => {
|
|
77
|
+
await new Promise(resolve => {
|
|
78
|
+
fac.req('foo:test:net', 'getIpInfo', ['8.8.8.8'], {}, (err) => {
|
|
79
|
+
t.is(err.message, 'ERR_GRAPE_LOOKUP_EMPTY')
|
|
80
|
+
resolve()
|
|
81
|
+
})
|
|
73
82
|
})
|
|
74
83
|
})
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
await t.test('double cb error', async (t) => {
|
|
77
86
|
const originalPeer = fac.peer
|
|
78
87
|
const originalConsoleError = console.error
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
89
|
+
await new Promise((resolve, reject) => {
|
|
90
|
+
let errorArgs
|
|
91
|
+
console.error = (...args) => {
|
|
92
|
+
if (errorArgs) {
|
|
93
|
+
reject(new Error('Should have been called once'))
|
|
94
|
+
}
|
|
95
|
+
errorArgs = args
|
|
84
96
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
assert.strictEqual(errorArgs[1], 'rest:util:net')
|
|
96
|
-
assert.strictEqual(errorArgs[2], 'getIpInfo')
|
|
97
|
-
done()
|
|
97
|
+
fac.peer = {
|
|
98
|
+
request (service, args, opts, cb) {
|
|
99
|
+
cb()
|
|
100
|
+
cb()
|
|
101
|
+
fac.peer = originalPeer
|
|
102
|
+
console.error = originalConsoleError
|
|
103
|
+
t.is(errorArgs[0], 'ERR_DOUBLE_CB')
|
|
104
|
+
t.is(errorArgs[1], 'rest:util:net')
|
|
105
|
+
t.is(errorArgs[2], 'getIpInfo')
|
|
106
|
+
}
|
|
98
107
|
}
|
|
99
|
-
}
|
|
100
108
|
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
fac.req('rest:util:net', 'getIpInfo', [], {}, () => {
|
|
110
|
+
t.is(errorArgs, undefined)
|
|
111
|
+
resolve()
|
|
112
|
+
})
|
|
103
113
|
})
|
|
104
114
|
})
|
|
105
115
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
await t.test('invalid args', async (t) => {
|
|
117
|
+
await new Promise(resolve => {
|
|
118
|
+
fac.req('rest:util:net', 'getIpInfo', {}, {}, (err) => {
|
|
119
|
+
t.is(err.message, 'ERR_GRC_REQ_ARGS_INVALID')
|
|
120
|
+
resolve()
|
|
121
|
+
})
|
|
110
122
|
})
|
|
111
123
|
})
|
|
112
124
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
125
|
+
await t.test('invalid action', async (t) => {
|
|
126
|
+
await new Promise(resolve => {
|
|
127
|
+
fac.req('rest:util:net', {}, [], {}, (err) => {
|
|
128
|
+
t.is(err.message, 'ERR_GRC_REQ_ACTION_INVALID')
|
|
129
|
+
resolve()
|
|
130
|
+
})
|
|
117
131
|
})
|
|
118
132
|
})
|
|
119
133
|
})
|
|
120
134
|
|
|
121
|
-
|
|
122
|
-
|
|
135
|
+
await t.test('promise', async (t) => {
|
|
136
|
+
await t.test('success', async (t) => {
|
|
123
137
|
const res = await fac.req('rest:util:net', 'getIpInfo', ['8.8.8.8'], {})
|
|
124
|
-
|
|
138
|
+
t.alike(['8.8.8.8', { country: 'US', region: 'CA' }], res)
|
|
125
139
|
})
|
|
126
140
|
|
|
127
|
-
|
|
141
|
+
await t.test('lookup error', async (t) => {
|
|
128
142
|
try {
|
|
129
143
|
await fac.req('foo:test:net', 'getIpInfo', [], {})
|
|
130
144
|
} catch (e) {
|
|
131
|
-
|
|
145
|
+
t.is(e.message, 'ERR_GRAPE_LOOKUP_EMPTY')
|
|
132
146
|
return
|
|
133
147
|
}
|
|
134
148
|
throw new Error('Should have thrown')
|
|
135
149
|
})
|
|
136
150
|
|
|
137
|
-
|
|
151
|
+
await t.test('double cb error', async (t) => {
|
|
138
152
|
const originalPeer = fac.peer
|
|
139
153
|
const originalConsoleError = console.error
|
|
140
154
|
|
|
@@ -142,9 +156,9 @@ describe('RPC integration: req', () => {
|
|
|
142
156
|
request (service, args, opts, cb) {
|
|
143
157
|
cb()
|
|
144
158
|
cb()
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
t.is(errorArgs[0], 'ERR_DOUBLE_CB')
|
|
160
|
+
t.is(errorArgs[1], 'rest:util:net')
|
|
161
|
+
t.is(errorArgs[2], 'getIpInfo')
|
|
148
162
|
fac.peer = originalPeer
|
|
149
163
|
console.error = originalConsoleError
|
|
150
164
|
}
|
|
@@ -161,24 +175,24 @@ describe('RPC integration: req', () => {
|
|
|
161
175
|
await fac.req('rest:util:net', 'getIpInfo', [], {})
|
|
162
176
|
})
|
|
163
177
|
|
|
164
|
-
|
|
178
|
+
await t.test('invalid args', async (t) => {
|
|
165
179
|
try {
|
|
166
180
|
await fac.req('rest:util:net', 'getIpInfo', {}, {})
|
|
167
181
|
} catch (e) {
|
|
168
|
-
|
|
182
|
+
t.is(e.message, 'ERR_GRC_REQ_ARGS_INVALID')
|
|
169
183
|
return
|
|
170
184
|
}
|
|
171
185
|
throw new Error('Should have thrown')
|
|
172
186
|
})
|
|
173
187
|
|
|
174
|
-
|
|
188
|
+
await t.test('invalid action', async (t) => {
|
|
175
189
|
try {
|
|
176
190
|
await fac.req('rest:util:net', {}, [], {})
|
|
177
191
|
} catch (e) {
|
|
178
|
-
|
|
192
|
+
t.is(e.message, 'ERR_GRC_REQ_ACTION_INVALID')
|
|
179
193
|
return
|
|
180
194
|
}
|
|
181
195
|
throw new Error('Should have thrown')
|
|
182
196
|
})
|
|
183
197
|
})
|
|
184
|
-
})
|
|
198
|
+
}))
|