@tak-ps/node-cot 3.5.3 → 4.0.0

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.
@@ -0,0 +1,431 @@
1
+ import test from 'tape';
2
+ import CoT from '../index.js';
3
+
4
+ test('CoT.is_friend', (t) => {
5
+ let cot = CoT.from_geojson({
6
+ type: 'Feature',
7
+ properties: {
8
+ type: 'a-f-B'
9
+ },
10
+ geometry: { type: 'Point', coordinates: [0,0] }
11
+ });
12
+
13
+ t.ok(cot.is_friend());
14
+
15
+ cot = CoT.from_geojson({
16
+ type: 'Feature',
17
+ properties: {
18
+ type: 'a-h-B'
19
+ },
20
+ geometry: { type: 'Point', coordinates: [0,0] }
21
+ });
22
+
23
+ t.notOk(cot.is_friend());
24
+
25
+ t.end();
26
+ });
27
+
28
+ test('CoT.is_hostile', (t) => {
29
+ let cot = CoT.from_geojson({
30
+ type: 'Feature',
31
+ properties: {
32
+ type: 'a-h-B'
33
+ },
34
+ geometry: { type: 'Point', coordinates: [0,0] }
35
+ });
36
+
37
+ t.ok(cot.is_hostile());
38
+
39
+ cot = CoT.from_geojson({
40
+ type: 'Feature',
41
+ properties: {
42
+ type: 'a-f-B'
43
+ },
44
+ geometry: { type: 'Point', coordinates: [0,0] }
45
+ });
46
+
47
+ t.notOk(cot.is_hostile());
48
+
49
+ t.end();
50
+ });
51
+
52
+ test('CoT.is_unknown', (t) => {
53
+ let cot = CoT.from_geojson({
54
+ type: 'Feature',
55
+ properties: {
56
+ type: 'a-u-B'
57
+ },
58
+ geometry: { type: 'Point', coordinates: [0,0] }
59
+ });
60
+
61
+ t.ok(cot.is_unknown());
62
+
63
+ cot = CoT.from_geojson({
64
+ type: 'Feature',
65
+ properties: {
66
+ type: 'a-f-B'
67
+ },
68
+ geometry: { type: 'Point', coordinates: [0,0] }
69
+ });
70
+
71
+ t.notOk(cot.is_unknown());
72
+
73
+ t.end();
74
+ });
75
+
76
+ test('CoT.is_pending', (t) => {
77
+ let cot = CoT.from_geojson({
78
+ type: 'Feature',
79
+ properties: {
80
+ type: 'a-p-B'
81
+ },
82
+ geometry: { type: 'Point', coordinates: [0,0] }
83
+ });
84
+
85
+ t.ok(cot.is_pending());
86
+
87
+ cot = CoT.from_geojson({
88
+ type: 'Feature',
89
+ properties: {
90
+ type: 'a-f-B'
91
+ },
92
+ geometry: { type: 'Point', coordinates: [0,0] }
93
+ });
94
+
95
+ t.notOk(cot.is_pending());
96
+
97
+ t.end();
98
+ });
99
+
100
+ test('CoT.is_assumed', (t) => {
101
+ let cot = CoT.from_geojson({
102
+ type: 'Feature',
103
+ properties: {
104
+ type: 'a-a-B'
105
+ },
106
+ geometry: { type: 'Point', coordinates: [0,0] }
107
+ });
108
+
109
+ t.ok(cot.is_assumed());
110
+
111
+ cot = CoT.from_geojson({
112
+ type: 'Feature',
113
+ properties: {
114
+ type: 'a-f-B'
115
+ },
116
+ geometry: { type: 'Point', coordinates: [0,0] }
117
+ });
118
+
119
+ t.notOk(cot.is_assumed());
120
+ t.end();
121
+ });
122
+
123
+ test('CoT.is_neutral', (t) => {
124
+ let cot = CoT.from_geojson({
125
+ type: 'Feature',
126
+ properties: {
127
+ type: 'a-n-B'
128
+ },
129
+ geometry: { type: 'Point', coordinates: [0,0] }
130
+ });
131
+
132
+ t.ok(cot.is_neutral());
133
+
134
+ cot = CoT.from_geojson({
135
+ type: 'Feature',
136
+ properties: {
137
+ type: 'a-f-B'
138
+ },
139
+ geometry: { type: 'Point', coordinates: [0,0] }
140
+ });
141
+
142
+ t.notOk(cot.is_neutral());
143
+ t.end();
144
+ });
145
+
146
+ test('CoT.is_suspect', (t) => {
147
+ let cot = CoT.from_geojson({
148
+ type: 'Feature',
149
+ properties: {
150
+ type: 'a-s-B'
151
+ },
152
+ geometry: { type: 'Point', coordinates: [0,0] }
153
+ });
154
+
155
+ t.ok(cot.is_suspect());
156
+
157
+ cot = CoT.from_geojson({
158
+ type: 'Feature',
159
+ properties: {
160
+ type: 'a-f-B'
161
+ },
162
+ geometry: { type: 'Point', coordinates: [0,0] }
163
+ });
164
+
165
+ t.notOk(cot.is_suspect());
166
+ t.end();
167
+ });
168
+
169
+ test('CoT.is_joker', (t) => {
170
+ let cot = CoT.from_geojson({
171
+ type: 'Feature',
172
+ properties: {
173
+ type: 'a-j-B'
174
+ },
175
+ geometry: { type: 'Point', coordinates: [0,0] }
176
+ });
177
+
178
+ t.ok(cot.is_joker());
179
+
180
+ cot = CoT.from_geojson({
181
+ type: 'Feature',
182
+ properties: {
183
+ type: 'a-f-B'
184
+ },
185
+ geometry: { type: 'Point', coordinates: [0,0] }
186
+ });
187
+
188
+ t.notOk(cot.is_joker());
189
+ t.end();
190
+ });
191
+
192
+ test('CoT.is_faker', (t) => {
193
+ let cot = CoT.from_geojson({
194
+ type: 'Feature',
195
+ properties: {
196
+ type: 'a-k-B'
197
+ },
198
+ geometry: { type: 'Point', coordinates: [0,0] }
199
+ });
200
+
201
+ t.ok(cot.is_faker());
202
+
203
+ cot = CoT.from_geojson({
204
+ type: 'Feature',
205
+ properties: {
206
+ type: 'a-f-B'
207
+ },
208
+ geometry: { type: 'Point', coordinates: [0,0] }
209
+ });
210
+
211
+ t.notOk(cot.is_faker());
212
+ t.end();
213
+ });
214
+
215
+ test('CoT.is_atom', (t) => {
216
+ let cot = CoT.from_geojson({
217
+ type: 'Feature',
218
+ properties: {
219
+ type: 'a-'
220
+ },
221
+ geometry: { type: 'Point', coordinates: [0,0] }
222
+ });
223
+
224
+ t.ok(cot.is_atom());
225
+
226
+ cot = CoT.from_geojson({
227
+ type: 'Feature',
228
+ properties: {
229
+ type: 'h'
230
+ },
231
+ geometry: { type: 'Point', coordinates: [0,0] }
232
+ });
233
+
234
+ t.notOk(cot.is_atom());
235
+ t.end();
236
+ });
237
+
238
+ test('CoT.is_airborne', (t) => {
239
+ let cot = CoT.from_geojson({
240
+ type: 'Feature',
241
+ properties: {
242
+ type: 'a-f-A'
243
+ },
244
+ geometry: { type: 'Point', coordinates: [0,0] }
245
+ });
246
+
247
+ t.ok(cot.is_airborne());
248
+
249
+ cot = CoT.from_geojson({
250
+ type: 'Feature',
251
+ properties: {
252
+ type: 'a-h-G'
253
+ },
254
+ geometry: { type: 'Point', coordinates: [0,0] }
255
+ });
256
+
257
+ t.notOk(cot.is_airborne());
258
+ t.end();
259
+ });
260
+
261
+ test('CoT.is_ground', (t) => {
262
+ let cot = CoT.from_geojson({
263
+ type: 'Feature',
264
+ properties: {
265
+ type: 'a-f-G'
266
+ },
267
+ geometry: { type: 'Point', coordinates: [0,0] }
268
+ });
269
+
270
+ t.ok(cot.is_ground());
271
+
272
+ cot = CoT.from_geojson({
273
+ type: 'Feature',
274
+ properties: {
275
+ type: 'a-h-A'
276
+ },
277
+ geometry: { type: 'Point', coordinates: [0,0] }
278
+ });
279
+
280
+ t.notOk(cot.is_ground());
281
+ t.end();
282
+ });
283
+
284
+ test('CoT.is_installation', (t) => {
285
+ let cot = CoT.from_geojson({
286
+ type: 'Feature',
287
+ properties: {
288
+ type: 'a-f-G-I'
289
+ },
290
+ geometry: { type: 'Point', coordinates: [0,0] }
291
+ });
292
+
293
+ t.ok(cot.is_installation());
294
+
295
+ cot = CoT.from_geojson({
296
+ type: 'Feature',
297
+ properties: {
298
+ type: 'a-f-G'
299
+ },
300
+ geometry: { type: 'Point', coordinates: [0,0] }
301
+ });
302
+
303
+ t.notOk(cot.is_installation());
304
+
305
+ cot = CoT.from_geojson({
306
+ type: 'Feature',
307
+ properties: {
308
+ type: 'a-h-A'
309
+ },
310
+ geometry: { type: 'Point', coordinates: [0,0] }
311
+ });
312
+
313
+ t.notOk(cot.is_installation());
314
+ t.end();
315
+ });
316
+
317
+ test('CoT.is_vehicle', (t) => {
318
+ let cot = CoT.from_geojson({
319
+ type: 'Feature',
320
+ properties: {
321
+ type: 'a-f-G-E-V'
322
+ },
323
+ geometry: { type: 'Point', coordinates: [0,0] }
324
+ });
325
+
326
+ t.ok(cot.is_vehicle());
327
+
328
+ cot = CoT.from_geojson({
329
+ type: 'Feature',
330
+ properties: {
331
+ type: 'a-h-G-E-V'
332
+ },
333
+ geometry: { type: 'Point', coordinates: [0,0] }
334
+ });
335
+
336
+ t.ok(cot.is_vehicle());
337
+
338
+ cot = CoT.from_geojson({
339
+ type: 'Feature',
340
+ properties: {
341
+ type: 'a-f-G-E'
342
+ },
343
+ geometry: { type: 'Point', coordinates: [0,0] }
344
+ });
345
+
346
+ t.notOk(cot.is_vehicle());
347
+ t.end();
348
+ });
349
+
350
+ test('CoT.is_equipment', (t) => {
351
+ let cot = CoT.from_geojson({
352
+ type: 'Feature',
353
+ properties: {
354
+ type: 'a-f-G-E'
355
+ },
356
+ geometry: { type: 'Point', coordinates: [0,0] }
357
+ });
358
+
359
+ t.ok(cot.is_equipment());
360
+
361
+ cot = CoT.from_geojson({
362
+ type: 'Feature',
363
+ properties: {
364
+ type: 'a-f-G'
365
+ },
366
+ geometry: { type: 'Point', coordinates: [0,0] }
367
+ });
368
+
369
+ t.notOk(cot.is_equipment());
370
+
371
+ t.end();
372
+ });
373
+
374
+ test('CoT.is_surface', (t) => {
375
+ let cot = CoT.from_geojson({
376
+ type: 'Feature',
377
+ properties: {
378
+ type: 'a-f-S'
379
+ },
380
+ geometry: { type: 'Point', coordinates: [0,0] }
381
+ });
382
+
383
+ t.ok(cot.is_surface());
384
+
385
+ cot = CoT.from_geojson({
386
+ type: 'Feature',
387
+ properties: {
388
+ type: 'a-f-G'
389
+ },
390
+ geometry: { type: 'Point', coordinates: [0,0] }
391
+ });
392
+
393
+ t.notOk(cot.is_surface());
394
+ t.end();
395
+ });
396
+
397
+ test('CoT.is_subsurface', (t) => {
398
+ let cot = CoT.from_geojson({
399
+ type: 'Feature',
400
+ properties: {
401
+ type: 'a-f-U'
402
+ },
403
+ geometry: { type: 'Point', coordinates: [0,0] }
404
+ });
405
+
406
+ t.ok(cot.is_subsurface());
407
+
408
+ cot = CoT.from_geojson({
409
+ type: 'Feature',
410
+ properties: {
411
+ type: 'a-f-G'
412
+ },
413
+ geometry: { type: 'Point', coordinates: [0,0] }
414
+ });
415
+
416
+ t.notOk(cot.is_subsurface());
417
+ t.end();
418
+ });
419
+
420
+ test('CoT.is_uav', (t) => {
421
+ let cot = CoT.from_geojson({
422
+ type: 'Feature',
423
+ properties: {
424
+ type: 'a-f-A-M-F-Q-r'
425
+ },
426
+ geometry: { type: 'Point', coordinates: [0,0] }
427
+ });
428
+
429
+ t.ok(cot.is_uav());
430
+ t.end();
431
+ });
@@ -1,8 +1,8 @@
1
1
  import test from 'tape';
2
- import { XML } from '../index.js';
2
+ import CoT from '../index.js';
3
3
 
4
- test('XML.from_geojson - Point', (t) => {
5
- const geo = XML.from_geojson({
4
+ test('CoT.from_geojson - Point', (t) => {
5
+ const geo = CoT.from_geojson({
6
6
  type: 'Feature',
7
7
  properties: {},
8
8
  geometry: {
@@ -30,8 +30,8 @@ test('XML.from_geojson - Point', (t) => {
30
30
  t.end();
31
31
  });
32
32
 
33
- test('XML.from_geojson - Polygon', (t) => {
34
- const geo = XML.from_geojson({
33
+ test('CoT.from_geojson - Polygon', (t) => {
34
+ const geo = CoT.from_geojson({
35
35
  type: 'Feature',
36
36
  properties: {},
37
37
  geometry: {
@@ -78,8 +78,8 @@ test('XML.from_geojson - Polygon', (t) => {
78
78
  t.end();
79
79
  });
80
80
 
81
- test('XML.from_geojson - LineString', (t) => {
82
- const geo = XML.from_geojson({
81
+ test('CoT.from_geojson - LineString', (t) => {
82
+ const geo = CoT.from_geojson({
83
83
  type: 'Feature',
84
84
  properties: {},
85
85
  geometry: {
@@ -126,8 +126,8 @@ test('XML.from_geojson - LineString', (t) => {
126
126
  t.end();
127
127
  });
128
128
 
129
- test('XML.from_geojson - Start', (t) => {
130
- const geo = XML.from_geojson({
129
+ test('CoT.from_geojson - Start', (t) => {
130
+ const geo = CoT.from_geojson({
131
131
  type: 'Feature',
132
132
  properties: {
133
133
  // 1hr in the future
@@ -154,8 +154,8 @@ test('XML.from_geojson - Start', (t) => {
154
154
  t.end();
155
155
  });
156
156
 
157
- test('XML.from_geojson - Start/Stale', (t) => {
158
- const geo = XML.from_geojson({
157
+ test('CoT.from_geojson - Start/Stale', (t) => {
158
+ const geo = CoT.from_geojson({
159
159
  type: 'Feature',
160
160
  properties: {
161
161
  // 1hr in the future
@@ -183,8 +183,8 @@ test('XML.from_geojson - Start/Stale', (t) => {
183
183
  t.end();
184
184
  });
185
185
 
186
- test('XML.from_geojson - Icon', (t) => {
187
- const geo = XML.from_geojson({
186
+ test('CoT.from_geojson - Icon', (t) => {
187
+ const geo = CoT.from_geojson({
188
188
  type: 'Feature',
189
189
  properties: {
190
190
  icon: '66f14976-4b62-4023-8edb-d8d2ebeaa336/Public Safety Air/EMS_ROTOR.png'
@@ -203,8 +203,8 @@ test('XML.from_geojson - Icon', (t) => {
203
203
  t.end();
204
204
  });
205
205
 
206
- test('XML.from_geojson - Height Above Earth', (t) => {
207
- t.deepEquals(XML.from_geojson({
206
+ test('CoT.from_geojson - Height Above Earth', (t) => {
207
+ t.deepEquals(CoT.from_geojson({
208
208
  type: 'Feature',
209
209
  properties: {
210
210
  },
@@ -220,7 +220,7 @@ test('XML.from_geojson - Height Above Earth', (t) => {
220
220
  le: '9999999.0'
221
221
  }, 'default hae');
222
222
 
223
- t.deepEquals(XML.from_geojson({
223
+ t.deepEquals(CoT.from_geojson({
224
224
  type: 'Feature',
225
225
  properties: {
226
226
  },
@@ -239,8 +239,8 @@ test('XML.from_geojson - Height Above Earth', (t) => {
239
239
  t.end();
240
240
  });
241
241
 
242
- test('XML.from_geojson - Course & Speed', (t) => {
243
- t.deepEquals(XML.from_geojson({
242
+ test('CoT.from_geojson - Course & Speed', (t) => {
243
+ t.deepEquals(CoT.from_geojson({
244
244
  type: 'Feature',
245
245
  properties: {
246
246
  course: 260,
@@ -260,8 +260,8 @@ test('XML.from_geojson - Course & Speed', (t) => {
260
260
  t.end();
261
261
  });
262
262
 
263
- test('XML.from_geojson - Remarks', (t) => {
264
- t.deepEquals(XML.from_geojson({
263
+ test('CoT.from_geojson - Remarks', (t) => {
264
+ t.deepEquals(CoT.from_geojson({
265
265
  type: 'Feature',
266
266
  properties: {
267
267
  course: 260,