@rootintf/protocol-2phw 2.1.5-api.2 → 2.2.2-api.2

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.
@@ -314,6 +314,39 @@ function l_RR_(obj, x) {
314
314
  }
315
315
  return Object.freeze(obj_new);
316
316
  }
317
+ function l_assert_(actual, required) {
318
+ if (!actual || typeof actual !== 'object')
319
+ return false;
320
+ if (!required || typeof required !== 'object')
321
+ return false;
322
+ const actualEntries = Object.entries(actual);
323
+ const requiredEntries = Object.entries(required);
324
+ // if (actualEntries.length === 0 && expectedEntries.length > 0)
325
+ // return false;
326
+ const actualValues = new Set();
327
+ for (const [, v] of actualEntries) {
328
+ if (typeof v !== 'number' || !Number.isFinite(v))
329
+ return false;
330
+ actualValues.add(v);
331
+ }
332
+ const usedRequiredValues = new Set();
333
+ for (const [k, v] of requiredEntries) {
334
+ if (typeof v !== 'number' || !Number.isFinite(v))
335
+ return false;
336
+ if (k in actual) {
337
+ if (actual[k] !== v)
338
+ return false;
339
+ }
340
+ else {
341
+ if (!actualValues.has(v))
342
+ return false;
343
+ }
344
+ if (usedRequiredValues.has(v))
345
+ return false;
346
+ usedRequiredValues.add(v);
347
+ }
348
+ return true;
349
+ }
317
350
  //-------------------------------------------------------------------------------------------------
318
351
  function handler_default_( /* ... */) {
319
352
  // https://stackoverflow.com/questions/18746440/passing-multiple-arguments-to-console-log
@@ -537,6 +570,7 @@ var logr_es = /*#__PURE__*/Object.freeze({
537
570
  l_LL: l_LL_,
538
571
  l_RR: l_RR_,
539
572
  l_array: l_array_,
573
+ l_assert: l_assert_,
540
574
  l_concat: l_concat_,
541
575
  l_length: l_length_,
542
576
  l_merge: l_merge_
@@ -754,7 +788,7 @@ function requireJsonMsg_cjs () {
754
788
 
755
789
  //-------------------------------------------------------------------------------------------------
756
790
  const LOGR_ = bitlogr.LOGR.get_instance();
757
- const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION', 'DROPS', 'HANDLERS']) });
791
+ const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION']) });
758
792
  const l_ = logr_.l;
759
793
  // console.log('File location:', import.meta.url, '[Implementation]');
760
794
  //-------------------------------------------------------------------------------------------------
@@ -1542,7 +1576,7 @@ class TwoPhW {
1542
1576
  }
1543
1577
  //-------------------------------------------------------------------------------------------------
1544
1578
  handler_json_msgAck(msg, json_msgAck) {
1545
- logr_.log(l_.HANDLERS, () => ['handler_json_msgAck: ', json_msgAck]);
1579
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgAck: ', json_msgAck]);
1546
1580
  if (JSON_MsgAckWarp.validate(json_msgAck) && this._handler_msgAckWarp(msg, json_msgAck))
1547
1581
  return true;
1548
1582
  if (JSON_MsgAckEngage.validate(json_msgAck) && this._handler_msgAckEngage(msg, json_msgAck))
@@ -1550,9 +1584,9 @@ class TwoPhW {
1550
1584
  return false;
1551
1585
  }
1552
1586
  handler_json_msgEffect(msg, json_msgEffect) {
1553
- logr_.log(l_.HANDLERS, () => ['handler_json_msgEffect: ', json_msgEffect]);
1554
- if (jsonMsg_cjsExports.JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect))
1555
- return true;
1587
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgEffect: ', json_msgEffect]);
1588
+ // if (JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect) )
1589
+ // return true;
1556
1590
  if (JSON_MsgEngage.validate(json_msgEffect) && this._handler_msgEngage(msg, json_msgEffect))
1557
1591
  return true;
1558
1592
  // if (JSON_MsgOptions.validate(json_msg) && this.handler_msgOptions_(this._config, msg, json_msg))
@@ -1560,7 +1594,7 @@ class TwoPhW {
1560
1594
  return false;
1561
1595
  }
1562
1596
  handler_json_msg(msg, json_msg) {
1563
- logr_.log(l_.HANDLERS, () => ['handler_json_msg: ', json_msg]);
1597
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msg: ', json_msg]);
1564
1598
  if (JSON_MsgWarp.validate(json_msg) && this._handler_msgWarp(msg, json_msg))
1565
1599
  return true;
1566
1600
  // https://attacomsian.com/blog/javascript-iterate-objects
@@ -1573,14 +1607,6 @@ class TwoPhW {
1573
1607
  // });
1574
1608
  return false;
1575
1609
  }
1576
- handler_json(msg, json) {
1577
- logr_.log(l_.HANDLERS, () => ['handler_json: ', json]);
1578
- if (jsonMsg_cjsExports.JSON_MsgEffect.validate(json) && this.handler_json_msgEffect(msg, json))
1579
- return true;
1580
- if (jsonMsg_cjsExports.JSON_Msg.validate(json) && this.handler_json_msg(msg, json))
1581
- return true;
1582
- return false;
1583
- }
1584
1610
  }
1585
1611
 
1586
1612
  exports.EventLog = EventLog;
package/dist/twoPhW.d.ts CHANGED
@@ -127,6 +127,5 @@ declare class TwoPhW {
127
127
  handler_json_msgAck(msg: t_msg, json_msgAck: any): boolean;
128
128
  handler_json_msgEffect(msg: t_msg, json_msgEffect: any): boolean;
129
129
  handler_json_msg(msg: t_msg, json_msg: any): boolean;
130
- handler_json(msg: t_msg, json: any): boolean;
131
130
  }
132
131
  export { EventLog, time_ttl_rtt_ as t_ttl_rtt, TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, logr_ as logr, JSON_Msg, JSON_MsgEffect, JSON_MsgAck, StateAckEngage, StateEngage, StateAckWarp, StateWarp, StateINVALID, StateInitialState };
@@ -312,6 +312,39 @@ function l_RR_(obj, x) {
312
312
  }
313
313
  return Object.freeze(obj_new);
314
314
  }
315
+ function l_assert_(actual, required) {
316
+ if (!actual || typeof actual !== 'object')
317
+ return false;
318
+ if (!required || typeof required !== 'object')
319
+ return false;
320
+ const actualEntries = Object.entries(actual);
321
+ const requiredEntries = Object.entries(required);
322
+ // if (actualEntries.length === 0 && expectedEntries.length > 0)
323
+ // return false;
324
+ const actualValues = new Set();
325
+ for (const [, v] of actualEntries) {
326
+ if (typeof v !== 'number' || !Number.isFinite(v))
327
+ return false;
328
+ actualValues.add(v);
329
+ }
330
+ const usedRequiredValues = new Set();
331
+ for (const [k, v] of requiredEntries) {
332
+ if (typeof v !== 'number' || !Number.isFinite(v))
333
+ return false;
334
+ if (k in actual) {
335
+ if (actual[k] !== v)
336
+ return false;
337
+ }
338
+ else {
339
+ if (!actualValues.has(v))
340
+ return false;
341
+ }
342
+ if (usedRequiredValues.has(v))
343
+ return false;
344
+ usedRequiredValues.add(v);
345
+ }
346
+ return true;
347
+ }
315
348
  //-------------------------------------------------------------------------------------------------
316
349
  function handler_default_( /* ... */) {
317
350
  // https://stackoverflow.com/questions/18746440/passing-multiple-arguments-to-console-log
@@ -535,6 +568,7 @@ var logr_es = /*#__PURE__*/Object.freeze({
535
568
  l_LL: l_LL_,
536
569
  l_RR: l_RR_,
537
570
  l_array: l_array_,
571
+ l_assert: l_assert_,
538
572
  l_concat: l_concat_,
539
573
  l_length: l_length_,
540
574
  l_merge: l_merge_
@@ -752,7 +786,7 @@ function requireJsonMsg_cjs () {
752
786
 
753
787
  //-------------------------------------------------------------------------------------------------
754
788
  const LOGR_ = bitlogr.LOGR.get_instance();
755
- const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION', 'DROPS', 'HANDLERS']) });
789
+ const logr_ = LOGR_.create({ labels: bitlogr.l_array(['VALIDATION']) });
756
790
  const l_ = logr_.l;
757
791
  // console.log('File location:', import.meta.url, '[Implementation]');
758
792
  //-------------------------------------------------------------------------------------------------
@@ -1540,7 +1574,7 @@ class TwoPhW {
1540
1574
  }
1541
1575
  //-------------------------------------------------------------------------------------------------
1542
1576
  handler_json_msgAck(msg, json_msgAck) {
1543
- logr_.log(l_.HANDLERS, () => ['handler_json_msgAck: ', json_msgAck]);
1577
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgAck: ', json_msgAck]);
1544
1578
  if (JSON_MsgAckWarp.validate(json_msgAck) && this._handler_msgAckWarp(msg, json_msgAck))
1545
1579
  return true;
1546
1580
  if (JSON_MsgAckEngage.validate(json_msgAck) && this._handler_msgAckEngage(msg, json_msgAck))
@@ -1548,9 +1582,9 @@ class TwoPhW {
1548
1582
  return false;
1549
1583
  }
1550
1584
  handler_json_msgEffect(msg, json_msgEffect) {
1551
- logr_.log(l_.HANDLERS, () => ['handler_json_msgEffect: ', json_msgEffect]);
1552
- if (jsonMsg_cjsExports.JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect))
1553
- return true;
1585
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgEffect: ', json_msgEffect]);
1586
+ // if (JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect) )
1587
+ // return true;
1554
1588
  if (JSON_MsgEngage.validate(json_msgEffect) && this._handler_msgEngage(msg, json_msgEffect))
1555
1589
  return true;
1556
1590
  // if (JSON_MsgOptions.validate(json_msg) && this.handler_msgOptions_(this._config, msg, json_msg))
@@ -1558,7 +1592,7 @@ class TwoPhW {
1558
1592
  return false;
1559
1593
  }
1560
1594
  handler_json_msg(msg, json_msg) {
1561
- logr_.log(l_.HANDLERS, () => ['handler_json_msg: ', json_msg]);
1595
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msg: ', json_msg]);
1562
1596
  if (JSON_MsgWarp.validate(json_msg) && this._handler_msgWarp(msg, json_msg))
1563
1597
  return true;
1564
1598
  // https://attacomsian.com/blog/javascript-iterate-objects
@@ -1571,14 +1605,6 @@ class TwoPhW {
1571
1605
  // });
1572
1606
  return false;
1573
1607
  }
1574
- handler_json(msg, json) {
1575
- logr_.log(l_.HANDLERS, () => ['handler_json: ', json]);
1576
- if (jsonMsg_cjsExports.JSON_MsgEffect.validate(json) && this.handler_json_msgEffect(msg, json))
1577
- return true;
1578
- if (jsonMsg_cjsExports.JSON_Msg.validate(json) && this.handler_json_msg(msg, json))
1579
- return true;
1580
- return false;
1581
- }
1582
1608
  }
1583
1609
 
1584
1610
  var JSON_Msg = jsonMsg_cjsExports.JSON_Msg;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootintf/protocol-2phw",
3
- "version": "2.1.5-api.2",
3
+ "version": "2.2.2-api.2",
4
4
  "description": "",
5
5
  "main": "dist/twoPhW.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,8 +27,8 @@
27
27
  },
28
28
  "homepage": "https://gitlab.com/interface-x/npm-protocol-2PhW.git#readme",
29
29
  "dependencies": {
30
- "@knev/bitlogr": "^3.1.3",
31
- "@rootintf/json-msg": "^2.1.6",
30
+ "@knev/bitlogr": "^3.2.2",
31
+ "@rootintf/json-msg": "^2.1.7",
32
32
  "ajv": "^8.17.1"
33
33
  },
34
34
  "devDependencies": {
@@ -36,12 +36,12 @@
36
36
  "@rollup/plugin-json": "^6.1.0",
37
37
  "@rollup/plugin-node-resolve": "^16.0.3",
38
38
  "@rollup/plugin-typescript": "^12.3.0",
39
- "@types/ajv": "^0.0.5",
40
- "@types/node": "^24.10.1",
39
+ "@types/ajv": "^1.0.4",
40
+ "@types/node": "^25.1.0",
41
41
  "ajv-cli": "^5.0.0",
42
42
  "del-cli": "^7.0.0",
43
- "jasmine": "^5.13.0",
44
- "rollup": "^4.53.3",
43
+ "jasmine": "^6.0.0",
44
+ "rollup": "^4.57.0",
45
45
  "tslib": "^2.8.1",
46
46
  "typescript": "^5.9.3",
47
47
  "uuid": "^13.0.0"
package/src/twoPhW.ts CHANGED
@@ -747,7 +747,7 @@ class TwoPhW {
747
747
 
748
748
  handler_json_msgAck(msg : t_msg, json_msgAck) : boolean
749
749
  {
750
- logr_.log(l_.HANDLERS, () => ['handler_json_msgAck: ', json_msgAck]);
750
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgAck: ', json_msgAck]);
751
751
 
752
752
  if (JSON_MsgAckWarp.validate(json_msgAck) && this._handler_msgAckWarp(msg, json_msgAck) )
753
753
  return true;
@@ -760,10 +760,10 @@ class TwoPhW {
760
760
 
761
761
  handler_json_msgEffect(msg : t_msg, json_msgEffect) : boolean
762
762
  {
763
- logr_.log(l_.HANDLERS, () => ['handler_json_msgEffect: ', json_msgEffect]);
763
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msgEffect: ', json_msgEffect]);
764
764
 
765
- if (JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect) )
766
- return true;
765
+ // if (JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect) )
766
+ // return true;
767
767
 
768
768
  if (JSON_MsgEngage.validate(json_msgEffect) && this._handler_msgEngage(msg, json_msgEffect) )
769
769
  return true;
@@ -776,7 +776,7 @@ class TwoPhW {
776
776
 
777
777
  handler_json_msg(msg : t_msg, json_msg) : boolean
778
778
  {
779
- logr_.log(l_.HANDLERS, () => ['handler_json_msg: ', json_msg]);
779
+ logr_.log(l_.HANDLERS, () => ['TwoPhW: handler_json_msg: ', json_msg]);
780
780
 
781
781
  if (JSON_MsgWarp.validate(json_msg) && this._handler_msgWarp(msg, json_msg) )
782
782
  return true;
@@ -793,18 +793,18 @@ class TwoPhW {
793
793
  return false;
794
794
  }
795
795
 
796
- handler_json(msg : t_msg, json) : boolean
797
- {
798
- logr_.log(l_.HANDLERS, () => ['handler_json: ', json]);
796
+ // handler_json(msg : t_msg, json) : boolean
797
+ // {
798
+ // logr_.log(l_.HANDLERS, () => ['handler_json: ', json]);
799
799
 
800
- if (JSON_MsgEffect.validate(json) && this.handler_json_msgEffect(msg, json) )
801
- return true;
800
+ // if (JSON_MsgEffect.validate(json) && this.handler_json_msgEffect(msg, json) )
801
+ // return true;
802
802
 
803
- if (JSON_Msg.validate(json) && this.handler_json_msg(msg, json) )
804
- return true;
803
+ // if (JSON_Msg.validate(json) && this.handler_json_msg(msg, json) )
804
+ // return true;
805
805
 
806
- return false;
807
- }
806
+ // return false;
807
+ // }
808
808
 
809
809
  };
810
810
 
@@ -32,7 +32,7 @@ const l_= logr_.l;
32
32
  LOGR_.toggle(l_, {
33
33
  VALIDATION : true
34
34
  });
35
- logr_.raw(() => ['twoPhW-new.spec: const l_ ', l_.get()])
35
+ logr_.raw('twoPhW-new.spec: const l_ ', l_.get())
36
36
 
37
37
  //-------------------------------------------------------------------------------------------------
38
38
 
@@ -284,7 +284,7 @@ describe('2PhW protocol', () => {
284
284
 
285
285
  it('receive JSON_MsgWarp', () => {
286
286
  jasmine.clock().tick(TTL_MSEC_1500 -STT_MSEC_1000 -1); // 1499
287
- twoPhW.handler_json(str_msgWarp_src, json_msgWarp_src);
287
+ twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
288
288
  expect(callback_msgWarp).toHaveBeenCalled();
289
289
  expect(eventLog.arr_events.length).toBe(1);
290
290
  expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
@@ -292,14 +292,14 @@ describe('2PhW protocol', () => {
292
292
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
293
293
 
294
294
  // dup
295
- twoPhW.handler_json(str_msgWarp_src, json_msgWarp_src);
295
+ twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
296
296
  expect(eventLog.arr_events.length).toBe(1);
297
297
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
298
298
  });
299
299
 
300
300
  it('receive JSON_MsgWarp expired', () => {
301
301
  jasmine.clock().tick(TTL_MSEC_1500 -STT_MSEC_1000); // 1500
302
- twoPhW.handler_json(str_msgWarp_src, json_msgWarp_src);
302
+ twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
303
303
  expect(callback_msgWarp).not.toHaveBeenCalled();
304
304
  expect(eventLog.arr_events.length).toBe(0);
305
305
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateInitialState).toBe(true);
@@ -309,13 +309,13 @@ describe('2PhW protocol', () => {
309
309
  const json_msgEngage_recvd= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
310
310
  json_msgEngage_recvd.referer= karr_referer_src;
311
311
 
312
- twoPhW.handler_json(json_msgEngage_recvd, json_msgEngage_recvd);
312
+ twoPhW.handler_json_msgEffect(json_msgEngage_recvd, json_msgEngage_recvd);
313
313
  expect(eventLog.arr_events.length).toBe(0);
314
314
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateInitialState).toBe(true);
315
315
  });
316
316
 
317
317
  it('traverse_State JSON_MsgWarp.compare(json_msgWarp, this._warp(json_msg).json_msgWarp )', () => {
318
- twoPhW.handler_json(str_msgWarp_src, json_msgWarp_src);
318
+ twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
319
319
  expect(eventLog.arr_events.length).toBe(1);
320
320
  expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
321
321
  expect(eventLog.arr_events[0].data).toEqual({ msg : str_msgWarp_src, json_msg: json_msgWarp_src });
@@ -326,7 +326,7 @@ describe('2PhW protocol', () => {
326
326
  };
327
327
  jasmine.clock().tick(1); // 1001, make sure it is th wrong date
328
328
  json_msgWarp_wrong_dt.dt= new Date().toISOString();
329
- twoPhW.handler_json(json_msgWarp_wrong_dt, json_msgWarp_wrong_dt);
329
+ twoPhW.handler_json_msg(json_msgWarp_wrong_dt, json_msgWarp_wrong_dt);
330
330
  expect(eventLog.arr_events.length).toBe(1);
331
331
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
332
332
  });
@@ -350,7 +350,7 @@ describe('2PhW protocol', () => {
350
350
 
351
351
  expect(Date.now()-T0).toBe(STT_MSEC_1000);
352
352
 
353
- twoPhW.handler_json(str_msgWarp_src, json_msgWarp_src);
353
+ twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
354
354
  expect(callback_msgWarp).toHaveBeenCalled();
355
355
  expect(eventLog.arr_events.length).toBe(1);
356
356
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
@@ -381,7 +381,7 @@ describe('2PhW protocol', () => {
381
381
  const json_msgEngage_src= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
382
382
  json_msgEngage_src.referer= karr_referer_src;
383
383
 
384
- twoPhW.handler_json(json_msgEngage_src, json_msgEngage_src);
384
+ twoPhW.handler_json_msgEffect(json_msgEngage_src, json_msgEngage_src);
385
385
  expect(eventLog.arr_events.length).toBe(2);
386
386
  });
387
387
 
@@ -396,7 +396,7 @@ describe('2PhW protocol', () => {
396
396
  json_msgEngage_src.referer= karr_referer_src;
397
397
 
398
398
  jasmine.clock().tick(STT_MSEC_1000); // 3000, STT_MSEC_1000 *3
399
- twoPhW.handler_json(json_msgEngage_src, json_msgEngage_src);
399
+ twoPhW.handler_json_msgEffect(json_msgEngage_src, json_msgEngage_src);
400
400
  expect(eventLog.arr_events.length).toBe(2);
401
401
  });
402
402
 
@@ -451,7 +451,7 @@ describe('2PhW protocol', () => {
451
451
  // - TTL= 1500, RTT= 2000; TTL*2 + RTT= 5000; timeout= 5000
452
452
  // - expires at 5000
453
453
 
454
- twoPhW.handler_json(str_msgEngage_src, json_msgEngage_src);
454
+ twoPhW.handler_json_msgEffect(str_msgEngage_src, json_msgEngage_src);
455
455
  expect(callback_msgEngage).not.toHaveBeenCalled();
456
456
  expect(eventLog.arr_events.length).toBe(2);
457
457
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
@@ -477,7 +477,7 @@ describe('2PhW protocol', () => {
477
477
 
478
478
  jasmine.clock().tick(STT_MSEC_1000); // 3000, STT_MSEC_1000 *3
479
479
 
480
- twoPhW.handler_json(str_msgEngage_src, json_msgEngage_src);
480
+ twoPhW.handler_json_msgEffect(str_msgEngage_src, json_msgEngage_src);
481
481
  expect(callback_msgEngage).toHaveBeenCalled();
482
482
  expect(callback_msg_sent_expired).not.toHaveBeenCalled();
483
483
  expect(eventLog.arr_events.length).toBe(3);
@@ -695,14 +695,14 @@ describe('2PhW protocol', () => {
695
695
  expect(callback_msgAckWarp).not.toHaveBeenCalled();
696
696
  expect(callback_msg_sent_expired).toHaveBeenCalled();
697
697
 
698
- twoPhW.handler_json(json_msgAckWarp_dst, json_msgAckWarp_dst);
698
+ twoPhW.handler_json_msgAck(json_msgAckWarp_dst, json_msgAckWarp_dst);
699
699
  expect(callback_msgAckWarp).not.toHaveBeenCalled();
700
700
  expect(eventLog.arr_events.length).toBe(1);
701
701
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
702
702
  });
703
703
 
704
704
  it('send JSON_MsgWarp == NACK', () => {
705
- twoPhW.handler_json(str_msgNackWarp_dst, json_msgNackWarp_dst);
705
+ twoPhW.handler_json_msgAck(str_msgNackWarp_dst, json_msgNackWarp_dst);
706
706
  expect(eventLog.arr_events.length).toBe(2);
707
707
  expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
708
708
  expect(eventLog.arr_events[1].data).toEqual({msg : str_msgNackWarp_dst, json_msg : json_msgNackWarp_dst });
@@ -717,7 +717,7 @@ describe('2PhW protocol', () => {
717
717
  json_msgAckEngage_recv.referer= karr_referer_dst;
718
718
 
719
719
  jasmine.clock().tick(STT_MSEC_1000); // 4000
720
- twoPhW.handler_json(json_msgAckEngage_recv, json_msgAckEngage_recv);
720
+ twoPhW.handler_json_msgAck(json_msgAckEngage_recv, json_msgAckEngage_recv);
721
721
  expect(eventLog.arr_events.length).toBe(2);
722
722
  });
723
723
 
@@ -731,7 +731,7 @@ describe('2PhW protocol', () => {
731
731
 
732
732
  expect(Date.now()-T0).toBe(RTT_MSEC_2000);
733
733
 
734
- twoPhW.handler_json(str_msgAckWarp_dst, json_msgAckWarp_dst);
734
+ twoPhW.handler_json_msgAck(str_msgAckWarp_dst, json_msgAckWarp_dst);
735
735
  expect(callback_msgAckWarp).toHaveBeenCalled();
736
736
  expect(eventLog.arr_events.length).toBe(2);
737
737
  expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
@@ -809,7 +809,7 @@ describe('2PhW protocol', () => {
809
809
  expect(Date.now()-T0).toBe(4999);
810
810
  expect(callback_msg_sent_expired).not.toHaveBeenCalled();
811
811
 
812
- twoPhW.handler_json(str_msgAckEngage_dst, json_msgAckEngage_dst);
812
+ twoPhW.handler_json_msgAck(str_msgAckEngage_dst, json_msgAckEngage_dst);
813
813
  expect(eventLog.arr_events.length).toBe(4);
814
814
  expect(eventLog.arr_events[3].type).toBe('2PhW[JSON_MsgAckEngage]');
815
815
  expect(eventLog.arr_events[3].data).toEqual({ msg: str_msgAckEngage_dst, json_msg : json_msgAckEngage_dst });
@@ -827,7 +827,7 @@ describe('2PhW protocol', () => {
827
827
  expect(callback_msg_sent_expired).toHaveBeenCalled();
828
828
 
829
829
  // test to make sure a late ack isn't a valid AckEngage state
830
- twoPhW.handler_json(str_msgAckEngage_dst, json_msgAckEngage_dst);
830
+ twoPhW.handler_json_msgAck(str_msgAckEngage_dst, json_msgAckEngage_dst);
831
831
  expect(eventLog.arr_events.length).toBe(3);
832
832
  expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
833
833
  });