@@ -11,11 +11,11 @@ import { client } from '../../../../src/lib/sql/client.js';
11
11
describe ( 'Get Probes' , ( ) => {
12
12
let requestAgent : SuperTest < Test > ;
13
13
const probes : Socket [ ] = [ ] ;
14
- let addProbe : ( ) => Promise < Socket > ;
14
+ let addProbe : ( events ?: object , options ?: object ) => Promise < Socket > ;
15
15
16
16
before ( async ( ) => {
17
- addProbe = async ( ) => {
18
- const probe = await addFakeProbe ( ) ;
17
+ addProbe = async ( events = { } , options = { } ) => {
18
+ const probe = await addFakeProbe ( events , options ) ;
19
19
probes . push ( probe ) ;
20
20
return probe ;
21
21
} ;
@@ -187,11 +187,12 @@ describe('Get Probes', () => {
187
187
. send ( )
188
188
. expect ( 200 )
189
189
. expect ( ( response ) => {
190
- expect ( response . body [ 0 ] ) . to . deep . include ( {
190
+ expect ( response . body [ 0 ] ) . to . deep . equal ( {
191
191
version : '0.14.0' ,
192
192
host : '' ,
193
193
ipAddress : '1.2.3.4' ,
194
194
uuid : '1-1-1-1-1' ,
195
+ nodeVersion : 'v18.17.0' ,
195
196
location : {
196
197
continent : 'SA' ,
197
198
region : 'South America' ,
@@ -213,6 +214,26 @@ describe('Get Probes', () => {
213
214
} ) ;
214
215
} ) ;
215
216
217
+ it ( 'should add hardware info if admin key is provided and there is hardware info' , async ( ) => {
218
+ nockGeoIpProviders ( { ip2location : 'argentina' , ipmap : 'argentina' , maxmind : 'argentina' , ipinfo : 'argentina' , fastly : 'argentina' } ) ;
219
+
220
+ const probe = await addProbe ( { } , { query : { isHardware : 'true' , hardwareDevice : 'v1' } } ) ;
221
+ probe . emit ( 'probe:status:update' , 'ready' ) ;
222
+
223
+ await requestAgent . get ( '/v1/probes?adminkey=admin' )
224
+ . send ( )
225
+ . expect ( 200 )
226
+ . expect ( ( response ) => {
227
+ expect ( response . body [ 0 ] ) . to . deep . include ( {
228
+ isHardware : true ,
229
+ hardwareDevice : 'v1' ,
230
+ } ) ;
231
+
232
+ expect ( response . body [ 0 ] . ipAddress ) . to . be . a ( 'string' ) ;
233
+ expect ( response ) . to . matchApiSchema ( ) ;
234
+ } ) ;
235
+ } ) ;
236
+
216
237
describe ( 'adopted probes' , ( ) => {
217
238
before ( async ( ) => {
218
239
await client ( ADOPTED_PROBES_TABLE ) . insert ( {
0 commit comments