tabletcommand-incident 0.4.12 → 0.4.13

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.
Files changed (279) hide show
  1. package/.cspell/project-words.txt +5 -0
  2. package/build/ruleLegacy/cleanupCommentsFilters.js +0 -21
  3. package/build/ruleLegacy/cleanupCommentsFilters.js.map +1 -1
  4. package/build/ruleProcessorLegacy.js +0 -73
  5. package/build/ruleProcessorLegacy.js.map +1 -1
  6. package/build/rules/index.js +81 -57
  7. package/build/rules/index.js.map +1 -1
  8. package/build/rules/join-call-type-priority.js +23 -3
  9. package/build/rules/join-call-type-priority.js.map +1 -1
  10. package/build/rules/set-fire-alarm-at-dispatch-from-alarm-level.js +65 -0
  11. package/build/rules/set-fire-alarm-at-dispatch-from-alarm-level.js.map +1 -0
  12. package/build/rules/set-fire-map-santa-clara-city copy.js +51 -0
  13. package/build/rules/set-fire-map-santa-clara-city copy.js.map +1 -0
  14. package/build/test/domain.js +53 -54
  15. package/build/test/domain.js.map +1 -1
  16. package/build/test/index.js +279 -98
  17. package/build/test/index.js.map +1 -1
  18. package/build/test/mock.js +288 -3
  19. package/build/test/mock.js.map +1 -1
  20. package/build/test/rules/clean-up-comments.js +4 -8
  21. package/build/test/rules/clean-up-comments.js.map +1 -1
  22. package/build/test/rules/clean-up-lat-long.js +5 -9
  23. package/build/test/rules/clean-up-lat-long.js.map +1 -1
  24. package/build/test/rules/clear-field.js +4 -8
  25. package/build/test/rules/clear-field.js.map +1 -1
  26. package/build/test/rules/close-incident-after-hours.js +8 -12
  27. package/build/test/rules/close-incident-after-hours.js.map +1 -1
  28. package/build/test/rules/close-incident-matching-incident-number.js +28 -29
  29. package/build/test/rules/close-incident-matching-incident-number.js.map +1 -1
  30. package/build/test/rules/close-incident-of-certain-type.js +8 -12
  31. package/build/test/rules/close-incident-of-certain-type.js.map +1 -1
  32. package/build/test/rules/join-call-type-priority.js +20 -11
  33. package/build/test/rules/join-call-type-priority.js.map +1 -1
  34. package/build/test/rules/map-unit-dates-verdugo.js +8 -9
  35. package/build/test/rules/map-unit-dates-verdugo.js.map +1 -1
  36. package/build/test/rules/remove-person-from-unit.js +6 -7
  37. package/build/test/rules/remove-person-from-unit.js.map +1 -1
  38. package/build/test/rules/set-address.js +5 -9
  39. package/build/test/rules/set-address.js.map +1 -1
  40. package/build/test/rules/set-channels-from-radio-channels.js +9 -13
  41. package/build/test/rules/set-channels-from-radio-channels.js.map +1 -1
  42. package/build/test/rules/set-city-alameda.js +5 -9
  43. package/build/test/rules/set-city-alameda.js.map +1 -1
  44. package/build/test/rules/set-city-calfire-lnu.js +5 -9
  45. package/build/test/rules/set-city-calfire-lnu.js.map +1 -1
  46. package/build/test/rules/set-city-cleanup.js +7 -11
  47. package/build/test/rules/set-city-cleanup.js.map +1 -1
  48. package/build/test/rules/set-city-southern-marin.js +5 -9
  49. package/build/test/rules/set-city-southern-marin.js.map +1 -1
  50. package/build/test/rules/set-city-verdugo.js +4 -8
  51. package/build/test/rules/set-city-verdugo.js.map +1 -1
  52. package/build/test/rules/set-comment-opts-ack-type.js +7 -8
  53. package/build/test/rules/set-comment-opts-ack-type.js.map +1 -1
  54. package/build/test/rules/set-common-place-name.js +4 -8
  55. package/build/test/rules/set-common-place-name.js.map +1 -1
  56. package/build/test/rules/set-communication-channels-from-radio-names.js +6 -10
  57. package/build/test/rules/set-communication-channels-from-radio-names.js.map +1 -1
  58. package/build/test/rules/set-cross-streets.js +16 -20
  59. package/build/test/rules/set-cross-streets.js.map +1 -1
  60. package/build/test/rules/set-fire-map-from-map-pages-southern-marin.js +4 -8
  61. package/build/test/rules/set-fire-map-from-map-pages-southern-marin.js.map +1 -1
  62. package/build/test/rules/set-fire-map-pages-ontario.js +5 -9
  63. package/build/test/rules/set-fire-map-pages-ontario.js.map +1 -1
  64. package/build/test/rules/set-fire-map-santa-clara-city.js +4 -8
  65. package/build/test/rules/set-fire-map-santa-clara-city.js.map +1 -1
  66. package/build/test/rules/set-format-units-pulsepoint.js +6 -7
  67. package/build/test/rules/set-format-units-pulsepoint.js.map +1 -1
  68. package/build/test/rules/set-incident-type-ontario.js +4 -8
  69. package/build/test/rules/set-incident-type-ontario.js.map +1 -1
  70. package/build/test/rules/set-location-preference-derry.js +10 -14
  71. package/build/test/rules/set-location-preference-derry.js.map +1 -1
  72. package/build/test/rules/set-location-preference.js +10 -14
  73. package/build/test/rules/set-location-preference.js.map +1 -1
  74. package/build/test/rules/set-map-incident-type-pulsepoint.js +4 -8
  75. package/build/test/rules/set-map-incident-type-pulsepoint.js.map +1 -1
  76. package/build/test/rules/set-prior-incident-comment-field.js +5 -6
  77. package/build/test/rules/set-prior-incident-comment-field.js.map +1 -1
  78. package/build/test/rules/set-street-number.js +5 -9
  79. package/build/test/rules/set-street-number.js.map +1 -1
  80. package/build/test/rulesLegacy.js +0 -245
  81. package/build/test/rulesLegacy.js.map +1 -1
  82. package/build/test/rulesLegacyCleanupCommentsFilters.js +0 -19
  83. package/build/test/rulesLegacyCleanupCommentsFilters.js.map +1 -1
  84. package/build/test/setIncidentType.js +5 -6
  85. package/build/test/setIncidentType.js.map +1 -1
  86. package/definitions/ruleLegacy/cleanupCommentsFilters.d.ts +0 -1
  87. package/definitions/ruleLegacy/cleanupCommentsFilters.d.ts.map +1 -1
  88. package/definitions/ruleProcessorLegacy.d.ts.map +1 -1
  89. package/definitions/rules/index.d.ts.map +1 -1
  90. package/definitions/rules/join-call-type-priority.d.ts +4 -1
  91. package/definitions/rules/join-call-type-priority.d.ts.map +1 -1
  92. package/definitions/rules/set-fire-alarm-at-dispatch-from-alarm-level.d.ts +11 -0
  93. package/definitions/rules/set-fire-alarm-at-dispatch-from-alarm-level.d.ts.map +1 -0
  94. package/definitions/rules/set-fire-map-santa-clara-city copy.d.ts +11 -0
  95. package/definitions/rules/set-fire-map-santa-clara-city copy.d.ts.map +1 -0
  96. package/definitions/test/mock.d.ts +6 -1
  97. package/definitions/test/mock.d.ts.map +1 -1
  98. package/package.json +8 -8
  99. package/src/ruleLegacy/cleanupCommentsFilters.js +0 -26
  100. package/src/ruleProcessorLegacy.js +0 -88
  101. package/src/rules/index.ts +92 -65
  102. package/src/rules/join-call-type-priority.ts +28 -3
  103. package/src/rules/set-fire-alarm-at-dispatch-from-alarm-level.ts +67 -0
  104. package/src/test/domain.ts +1 -3
  105. package/src/test/index.ts +295 -62
  106. package/src/test/mock.ts +293 -3
  107. package/src/test/rules/clean-up-comments.ts +1 -2
  108. package/src/test/rules/clean-up-lat-long.ts +1 -2
  109. package/src/test/rules/clear-field.ts +1 -2
  110. package/src/test/rules/close-incident-after-hours.ts +1 -2
  111. package/src/test/rules/close-incident-matching-incident-number.ts +2 -2
  112. package/src/test/rules/close-incident-of-certain-type.ts +1 -2
  113. package/src/test/rules/join-call-type-priority.ts +19 -5
  114. package/src/test/rules/map-unit-dates-verdugo.ts +1 -3
  115. package/src/test/rules/remove-person-from-unit.ts +1 -2
  116. package/src/test/rules/set-address.ts +1 -2
  117. package/src/test/rules/set-channels-from-radio-channels.ts +1 -2
  118. package/src/test/rules/set-city-alameda.ts +1 -2
  119. package/src/test/rules/set-city-calfire-lnu.ts +1 -2
  120. package/src/test/rules/set-city-cleanup.ts +1 -2
  121. package/src/test/rules/set-city-southern-marin.ts +1 -2
  122. package/src/test/rules/set-city-verdugo.ts +1 -2
  123. package/src/test/rules/set-comment-opts-ack-type.ts +1 -2
  124. package/src/test/rules/set-common-place-name.ts +1 -2
  125. package/src/test/rules/set-communication-channels-from-radio-names.ts +1 -2
  126. package/src/test/rules/set-cross-streets.ts +1 -2
  127. package/src/test/rules/set-fire-map-from-map-pages-southern-marin.ts +1 -2
  128. package/src/test/rules/set-fire-map-pages-ontario.ts +1 -2
  129. package/src/test/rules/set-fire-map-santa-clara-city.ts +1 -2
  130. package/src/test/rules/set-format-units-pulsepoint.ts +1 -2
  131. package/src/test/rules/set-incident-type-ontario.ts +1 -2
  132. package/src/test/rules/set-location-preference-derry.ts +1 -2
  133. package/src/test/rules/set-location-preference.ts +1 -2
  134. package/src/test/rules/set-map-incident-type-pulsepoint.ts +1 -2
  135. package/src/test/rules/set-prior-incident-comment-field.ts +2 -3
  136. package/src/test/rules/set-street-number.ts +1 -2
  137. package/src/test/rulesLegacy.js +1 -272
  138. package/src/test/rulesLegacyCleanupCommentsFilters.js +0 -22
  139. package/src/test/setIncidentType.ts +1 -3
  140. package/build/ruleLegacy/removePersonFromUnit.js +0 -35
  141. package/build/ruleLegacy/removePersonFromUnit.js.map +0 -1
  142. package/build/ruleLegacy/setAgencyCallTypeClarkCounty.js +0 -18
  143. package/build/ruleLegacy/setAgencyCallTypeClarkCounty.js.map +0 -1
  144. package/build/ruleLegacy/setCommunicationChannelsFromRadioNames.js +0 -50
  145. package/build/ruleLegacy/setCommunicationChannelsFromRadioNames.js.map +0 -1
  146. package/build/ruleLegacy/setFireMapEmptyString.js +0 -15
  147. package/build/ruleLegacy/setFireMapEmptyString.js.map +0 -1
  148. package/definitions/location.d.ts +0 -10
  149. package/definitions/location.d.ts.map +0 -1
  150. package/definitions/rule/cleanupComments.d.ts +0 -3
  151. package/definitions/rule/cleanupComments.d.ts.map +0 -1
  152. package/definitions/rule/cleanupCommentsFilters.d.ts +0 -8
  153. package/definitions/rule/cleanupCommentsFilters.d.ts.map +0 -1
  154. package/definitions/rule/cleanupLatLongSantaClaraCity.d.ts +0 -3
  155. package/definitions/rule/cleanupLatLongSantaClaraCity.d.ts.map +0 -1
  156. package/definitions/rule/cleanupNull.d.ts +0 -3
  157. package/definitions/rule/cleanupNull.d.ts.map +0 -1
  158. package/definitions/rule/cleanupReportNumber.d.ts +0 -3
  159. package/definitions/rule/cleanupReportNumber.d.ts.map +0 -1
  160. package/definitions/rule/closeIncidentAfterHours.d.ts +0 -3
  161. package/definitions/rule/closeIncidentAfterHours.d.ts.map +0 -1
  162. package/definitions/rule/closeIncidentMatchingIncidentNumber.d.ts +0 -3
  163. package/definitions/rule/closeIncidentMatchingIncidentNumber.d.ts.map +0 -1
  164. package/definitions/rule/closeIncidentOfCertainType.d.ts +0 -3
  165. package/definitions/rule/closeIncidentOfCertainType.d.ts.map +0 -1
  166. package/definitions/rule/copyCommandName.d.ts +0 -3
  167. package/definitions/rule/copyCommandName.d.ts.map +0 -1
  168. package/definitions/rule/copyIncidentNumber.d.ts +0 -3
  169. package/definitions/rule/copyIncidentNumber.d.ts.map +0 -1
  170. package/definitions/rule/copyLocationComment.d.ts +0 -3
  171. package/definitions/rule/copyLocationComment.d.ts.map +0 -1
  172. package/definitions/rule/mapUnitDatesVerdugo.d.ts +0 -3
  173. package/definitions/rule/mapUnitDatesVerdugo.d.ts.map +0 -1
  174. package/definitions/rule/rebuildUnitDispatchNumber.d.ts +0 -3
  175. package/definitions/rule/rebuildUnitDispatchNumber.d.ts.map +0 -1
  176. package/definitions/rule/removeEmptyPersonFromUnit.d.ts +0 -3
  177. package/definitions/rule/removeEmptyPersonFromUnit.d.ts.map +0 -1
  178. package/definitions/rule/removeField.d.ts +0 -3
  179. package/definitions/rule/removeField.d.ts.map +0 -1
  180. package/definitions/rule/removePersonFromUnit.d.ts +0 -3
  181. package/definitions/rule/removePersonFromUnit.d.ts.map +0 -1
  182. package/definitions/rule/setAgencyCallTypeClarkCounty.d.ts +0 -3
  183. package/definitions/rule/setAgencyCallTypeClarkCounty.d.ts.map +0 -1
  184. package/definitions/rule/setChannelUrlForDepartment.d.ts +0 -3
  185. package/definitions/rule/setChannelUrlForDepartment.d.ts.map +0 -1
  186. package/definitions/rule/setChannelsFromRadioChannels.d.ts +0 -3
  187. package/definitions/rule/setChannelsFromRadioChannels.d.ts.map +0 -1
  188. package/definitions/rule/setCityAlameda.d.ts +0 -3
  189. package/definitions/rule/setCityAlameda.d.ts.map +0 -1
  190. package/definitions/rule/setCityCalfireLNU.d.ts +0 -3
  191. package/definitions/rule/setCityCalfireLNU.d.ts.map +0 -1
  192. package/definitions/rule/setCitySouthernMarin.d.ts +0 -3
  193. package/definitions/rule/setCitySouthernMarin.d.ts.map +0 -1
  194. package/definitions/rule/setCommonPlaceName.d.ts +0 -3
  195. package/definitions/rule/setCommonPlaceName.d.ts.map +0 -1
  196. package/definitions/rule/setCommunicationChannelsFromRadioNames.d.ts +0 -3
  197. package/definitions/rule/setCommunicationChannelsFromRadioNames.d.ts.map +0 -1
  198. package/definitions/rule/setCrossStreets.d.ts +0 -3
  199. package/definitions/rule/setCrossStreets.d.ts.map +0 -1
  200. package/definitions/rule/setFireMapEmptyString.d.ts +0 -3
  201. package/definitions/rule/setFireMapEmptyString.d.ts.map +0 -1
  202. package/definitions/rule/setFireMapFromMapPagesSouthernMarin.d.ts +0 -3
  203. package/definitions/rule/setFireMapFromMapPagesSouthernMarin.d.ts.map +0 -1
  204. package/definitions/rule/setFireMapSantaClaraCity.d.ts +0 -3
  205. package/definitions/rule/setFireMapSantaClaraCity.d.ts.map +0 -1
  206. package/definitions/rule/setFormatUnitsPulsepoint.d.ts +0 -3
  207. package/definitions/rule/setFormatUnitsPulsepoint.d.ts.map +0 -1
  208. package/definitions/rule/setFullAddress.d.ts +0 -3
  209. package/definitions/rule/setFullAddress.d.ts.map +0 -1
  210. package/definitions/rule/setLatitudeLongitude.d.ts +0 -3
  211. package/definitions/rule/setLatitudeLongitude.d.ts.map +0 -1
  212. package/definitions/rule/setLegacyPriorIncidentChanged.d.ts +0 -3
  213. package/definitions/rule/setLegacyPriorIncidentChanged.d.ts.map +0 -1
  214. package/definitions/rule/setLegacyRenameUnit.d.ts +0 -3
  215. package/definitions/rule/setLegacyRenameUnit.d.ts.map +0 -1
  216. package/definitions/rule/setLocationPreferenceDerry.d.ts +0 -3
  217. package/definitions/rule/setLocationPreferenceDerry.d.ts.map +0 -1
  218. package/definitions/rule/setLocationPreferenceTorrance.d.ts +0 -3
  219. package/definitions/rule/setLocationPreferenceTorrance.d.ts.map +0 -1
  220. package/definitions/rule/setMapIncidentTypePulsepoint.d.ts +0 -3
  221. package/definitions/rule/setMapIncidentTypePulsepoint.d.ts.map +0 -1
  222. package/definitions/rule/setPriorIncidentCommentField.d.ts +0 -3
  223. package/definitions/rule/setPriorIncidentCommentField.d.ts.map +0 -1
  224. package/definitions/rule/setRadioChannelsFromLegacyChannels.d.ts +0 -3
  225. package/definitions/rule/setRadioChannelsFromLegacyChannels.d.ts.map +0 -1
  226. package/definitions/rule/setRadioChannelsFromRadioNames.d.ts +0 -3
  227. package/definitions/rule/setRadioChannelsFromRadioNames.d.ts.map +0 -1
  228. package/definitions/rule/setStreetNumber.d.ts +0 -3
  229. package/definitions/rule/setStreetNumber.d.ts.map +0 -1
  230. package/definitions/rule/setUnitDispatchNumberAsString.d.ts +0 -3
  231. package/definitions/rule/setUnitDispatchNumberAsString.d.ts.map +0 -1
  232. package/definitions/rule/setUnitUUID.d.ts +0 -3
  233. package/definitions/rule/setUnitUUID.d.ts.map +0 -1
  234. package/definitions/rule/translateCityVerdugo.d.ts +0 -3
  235. package/definitions/rule/translateCityVerdugo.d.ts.map +0 -1
  236. package/definitions/rule-processor.d.ts +0 -2
  237. package/definitions/rule-processor.d.ts.map +0 -1
  238. package/definitions/ruleLegacy/copyIncidentNumber.d.ts +0 -3
  239. package/definitions/ruleLegacy/copyIncidentNumber.d.ts.map +0 -1
  240. package/definitions/ruleLegacy/copyLocationComment.d.ts +0 -3
  241. package/definitions/ruleLegacy/copyLocationComment.d.ts.map +0 -1
  242. package/definitions/ruleLegacy/removePersonFromUnit.d.ts +0 -3
  243. package/definitions/ruleLegacy/removePersonFromUnit.d.ts.map +0 -1
  244. package/definitions/ruleLegacy/setAgencyCallTypeClarkCounty.d.ts +0 -3
  245. package/definitions/ruleLegacy/setAgencyCallTypeClarkCounty.d.ts.map +0 -1
  246. package/definitions/ruleLegacy/setCityAlameda.d.ts +0 -3
  247. package/definitions/ruleLegacy/setCityAlameda.d.ts.map +0 -1
  248. package/definitions/ruleLegacy/setCityCalfireLNU.d.ts +0 -3
  249. package/definitions/ruleLegacy/setCityCalfireLNU.d.ts.map +0 -1
  250. package/definitions/ruleLegacy/setCitySouthernMarin.d.ts +0 -3
  251. package/definitions/ruleLegacy/setCitySouthernMarin.d.ts.map +0 -1
  252. package/definitions/ruleLegacy/setCommonPlaceName.d.ts +0 -3
  253. package/definitions/ruleLegacy/setCommonPlaceName.d.ts.map +0 -1
  254. package/definitions/ruleLegacy/setCommunicationChannelsFromRadioNames.d.ts +0 -3
  255. package/definitions/ruleLegacy/setCommunicationChannelsFromRadioNames.d.ts.map +0 -1
  256. package/definitions/ruleLegacy/setCrossStreets.d.ts +0 -3
  257. package/definitions/ruleLegacy/setCrossStreets.d.ts.map +0 -1
  258. package/definitions/ruleLegacy/setFireMapEmptyString.d.ts +0 -3
  259. package/definitions/ruleLegacy/setFireMapEmptyString.d.ts.map +0 -1
  260. package/definitions/ruleLegacy/setFireMapFromMapPagesSouthernMarin.d.ts +0 -3
  261. package/definitions/ruleLegacy/setFireMapFromMapPagesSouthernMarin.d.ts.map +0 -1
  262. package/definitions/ruleLegacy/setFullAddress.d.ts +0 -3
  263. package/definitions/ruleLegacy/setFullAddress.d.ts.map +0 -1
  264. package/definitions/ruleLegacy/setPriorIncidentCommentField.d.ts +0 -3
  265. package/definitions/ruleLegacy/setPriorIncidentCommentField.d.ts.map +0 -1
  266. package/definitions/ruleLegacy/translateCityVerdugo.d.ts +0 -3
  267. package/definitions/ruleLegacy/translateCityVerdugo.d.ts.map +0 -1
  268. package/definitions/set-incident-type.d.ts +0 -20
  269. package/definitions/set-incident-type.d.ts.map +0 -1
  270. package/definitions/test/rules.d.ts +0 -2
  271. package/definitions/test/rules.d.ts.map +0 -1
  272. package/definitions/test/rulesCleanupCommentsFilters.d.ts +0 -2
  273. package/definitions/test/rulesCleanupCommentsFilters.d.ts.map +0 -1
  274. package/definitions/test/set-incident-type.d.ts +0 -2
  275. package/definitions/test/set-incident-type.d.ts.map +0 -1
  276. package/src/ruleLegacy/removePersonFromUnit.js +0 -37
  277. package/src/ruleLegacy/setAgencyCallTypeClarkCounty.js +0 -20
  278. package/src/ruleLegacy/setCommunicationChannelsFromRadioNames.js +0 -58
  279. package/src/ruleLegacy/setFireMapEmptyString.js +0 -15
@@ -26,11 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const chai_1 = __importDefault(require("chai"));
29
+ const chai_1 = require("chai");
30
30
  require("mocha");
31
31
  const lodash_1 = __importDefault(require("lodash"));
32
32
  const modelsModule = __importStar(require("tabletcommand-backend-models"));
33
- const assert = chai_1.default.assert;
34
33
  const index_1 = require("../index");
35
34
  const mock_1 = __importDefault(require("./mock"));
36
35
  let mock;
@@ -61,230 +60,378 @@ describe("index", function () {
61
60
  function validateRulesResult(sut) {
62
61
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
63
62
  if ("error" in sut) {
64
- assert.fail(sut.error.toString());
63
+ chai_1.assert.fail(sut.error.toString());
65
64
  }
66
65
  else {
67
66
  const { incident } = sut;
68
67
  // console.log("incident", incident);
69
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "Main Street, Mountain City 94549", "Should match full_address");
68
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "Main Street, Mountain City 94549", "Should match full_address");
70
69
  const foundAddressComment = ((_a = incident === null || incident === void 0 ? void 0 : incident.Comment) !== null && _a !== void 0 ? _a : []).filter(function (c) { return c.Comment.match(/^Address:/); });
71
- assert.strictEqual(foundAddressComment.length, 1);
72
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.cross_streets, "500 North St / 250 West St");
73
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CrossStreet1, undefined);
74
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CrossStreet2, undefined);
70
+ chai_1.assert.strictEqual(foundAddressComment.length, 1);
71
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.cross_streets, "500 North St / 250 West St");
72
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CrossStreet1, undefined);
73
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CrossStreet2, undefined);
75
74
  // expect CommonPlaceName to be copied from LocationComment
76
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CommonPlaceName, expectedCommonPlaceName);
75
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CommonPlaceName, expectedCommonPlaceName);
77
76
  // copied here by the IncidentRuleCopyIncidentNumber rule
78
77
  const foundLocationComment = ((_b = incident === null || incident === void 0 ? void 0 : incident.Comment) !== null && _b !== void 0 ? _b : []).filter(function (c) { return c.Comment.match("Location Comment:"); });
79
- assert.strictEqual(foundLocationComment.length, 1);
78
+ chai_1.assert.strictEqual(foundLocationComment.length, 1);
80
79
  const foundSpecificLocationComment = foundLocationComment.filter(function (c) { return c.Comment.match(expectedCommonPlaceName); });
81
- assert.strictEqual(foundSpecificLocationComment.length, 1);
80
+ chai_1.assert.strictEqual(foundSpecificLocationComment.length, 1);
82
81
  // copied here by IncidentRuleCopyIncidentNumber rule
83
82
  const foundIncidentComment = ((_c = incident === null || incident === void 0 ? void 0 : incident.Comment) !== null && _c !== void 0 ? _c : []).filter(function (c) { return c.Comment.match("Incident Number"); });
84
- assert.strictEqual(foundIncidentComment.length, 1);
83
+ chai_1.assert.strictEqual(foundIncidentComment.length, 1);
85
84
  const notificationType = lodash_1.default.first(((_d = incident === null || incident === void 0 ? void 0 : incident.notificationType) !== null && _d !== void 0 ? _d : []).filter((nt) => nt.value === "test"));
86
- assert.isObject(notificationType);
85
+ chai_1.assert.isObject(notificationType);
87
86
  const priorIncidentsNoComments = lodash_1.default.first(((_e = incident === null || incident === void 0 ? void 0 : incident.PriorIncident) !== null && _e !== void 0 ? _e : []).filter((p) => p.Problem === "Missing Comment Array"));
88
- assert.isObject(priorIncidentsNoComments);
89
- assert.strictEqual(priorIncidentsNoComments === null || priorIncidentsNoComments === void 0 ? void 0 : priorIncidentsNoComments.Comment.length, 0);
87
+ chai_1.assert.isObject(priorIncidentsNoComments);
88
+ chai_1.assert.strictEqual(priorIncidentsNoComments === null || priorIncidentsNoComments === void 0 ? void 0 : priorIncidentsNoComments.Comment.length, 0);
90
89
  const priorIncidents1Comment = lodash_1.default.first(((_f = incident === null || incident === void 0 ? void 0 : incident.PriorIncident) !== null && _f !== void 0 ? _f : []).filter((p) => p.Problem === "Has 1 Comment"));
91
- assert.isObject(priorIncidents1Comment);
92
- assert.strictEqual(priorIncidents1Comment === null || priorIncidents1Comment === void 0 ? void 0 : priorIncidents1Comment.Comment.length, 1);
90
+ chai_1.assert.isObject(priorIncidents1Comment);
91
+ chai_1.assert.strictEqual(priorIncidents1Comment === null || priorIncidents1Comment === void 0 ? void 0 : priorIncidents1Comment.Comment.length, 1);
93
92
  const ackComment = lodash_1.default.first(((_g = incident === null || incident === void 0 ? void 0 : incident.Comment) !== null && _g !== void 0 ? _g : []).filter((c) => c.CommentSource === "ACK1"));
94
- assert.isObject(ackComment);
95
- assert.equal((_h = ackComment === null || ackComment === void 0 ? void 0 : ackComment.CommentOpts) === null || _h === void 0 ? void 0 : _h.type, "ack");
96
- assert.equal((_j = ackComment === null || ackComment === void 0 ? void 0 : ackComment.CommentOpts) === null || _j === void 0 ? void 0 : _j.item, "hello");
93
+ chai_1.assert.isObject(ackComment);
94
+ chai_1.assert.equal((_h = ackComment === null || ackComment === void 0 ? void 0 : ackComment.CommentOpts) === null || _h === void 0 ? void 0 : _h.type, "ack");
95
+ chai_1.assert.equal((_j = ackComment === null || ackComment === void 0 ? void 0 : ackComment.CommentOpts) === null || _j === void 0 ? void 0 : _j.item, "hello");
97
96
  }
98
97
  }
99
98
  it("process stream through legacy", async function () {
100
99
  const existingStreamItems = await mock.getIncidentStreamItems(mock.departmentId, sampleIncidentNumber);
101
100
  const streamItem = lodash_1.default.first(existingStreamItems);
102
101
  if (!streamItem) {
103
- assert.fail("Expecting a stream item");
102
+ chai_1.assert.fail("Expecting a stream item");
104
103
  return;
105
104
  }
106
105
  const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentDemoRTS, atDate);
107
106
  validateRulesResult(sut);
108
- // console.log(typeof incidentProcessor);
109
- // assert.isTrue(true);
110
107
  });
111
108
  it("process stream through correction", async function () {
112
109
  const existingStreamItems = await mock.getIncidentStreamItems(mock.departmentId, sampleIncidentNumber);
113
110
  const streamItem = lodash_1.default.first(existingStreamItems);
114
111
  if (!streamItem) {
115
- assert.fail("Expecting a stream item");
112
+ chai_1.assert.fail("Expecting a stream item");
116
113
  return;
117
114
  }
118
115
  const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentDemoRTS, atDate);
119
116
  validateRulesResult(sut);
120
- // assert.isTrue(true);
121
117
  });
122
118
  });
123
- context("Southern Marin", function () {
119
+ context("Alameda", function () {
124
120
  const atDate = new Date();
125
- const sampleIncidentNumber = "Southern-Marin-0001";
121
+ const sampleIncidentNumber = "Alameda-0001";
126
122
  function validateRulesResult(sut) {
127
- var _a, _b;
128
123
  if ("error" in sut) {
129
- assert.fail(sut.error.toString());
124
+ chai_1.assert.fail(sut.error.toString());
130
125
  }
131
126
  else {
132
127
  const { incident } = sut;
133
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "190 BARN AVE, BLDG: B22 # S1, Fairfax", "Should match full_address");
134
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Fairfax");
135
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.FireMap, "ROT_31");
136
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.ClosedDateTime, "");
137
- assert.isNotNull(incident === null || incident === void 0 ? void 0 : incident.expiration_date, "Should have expiration date");
138
- const u10 = lodash_1.default.first(((_a = incident === null || incident === void 0 ? void 0 : incident.units) !== null && _a !== void 0 ? _a : []).filter((u) => u.UnitID === "M10"));
139
- assert.isObject(u10);
140
- assert.isArray(u10 === null || u10 === void 0 ? void 0 : u10.Personnel);
141
- assert.equal((_b = u10 === null || u10 === void 0 ? void 0 : u10.Personnel) === null || _b === void 0 ? void 0 : _b.length, 0);
128
+ // console.log(incident?.full_address);
129
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "22593 SIERRA AV, Hayward", "Should match full_address");
130
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Hayward");
142
131
  }
143
132
  }
144
133
  it("process stream through legacy", async function () {
145
- const departmentId = mock.departmentSouthernMarin._id;
134
+ const departmentId = mock.departmentAlameda._id;
146
135
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
147
136
  const streamItem = lodash_1.default.first(existingStreamItems);
148
137
  if (!streamItem) {
149
- assert.fail("Expecting a stream item");
138
+ chai_1.assert.fail("Expecting a stream item");
150
139
  return;
151
140
  }
152
- const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentSouthernMarin, atDate);
141
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentAlameda, atDate);
153
142
  validateRulesResult(sut);
154
- // console.log(typeof incidentProcessor);
155
- // assert.isTrue(true);
156
143
  });
157
144
  it("process stream through correction", async function () {
158
- const departmentId = mock.departmentSouthernMarin._id;
145
+ const departmentId = mock.departmentAlameda._id;
159
146
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
160
147
  const streamItem = lodash_1.default.first(existingStreamItems);
161
148
  if (!streamItem) {
162
- assert.fail("Expecting a stream item");
149
+ chai_1.assert.fail("Expecting a stream item");
163
150
  return;
164
151
  }
165
- const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentSouthernMarin, atDate);
152
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentAlameda, atDate);
166
153
  validateRulesResult(sut);
167
- // assert.isTrue(true);
168
154
  });
169
155
  });
170
- context("Alameda", function () {
156
+ context("Calfire CZU", function () {
171
157
  const atDate = new Date();
172
- const sampleIncidentNumber = "Alameda-0001";
158
+ const sampleIncidentNumber = "Calfire-CZU-0001";
173
159
  function validateRulesResult(sut) {
174
160
  if ("error" in sut) {
175
- assert.fail(sut.error.toString());
161
+ chai_1.assert.fail(sut.error.toString());
176
162
  }
177
163
  else {
178
164
  const { incident } = sut;
179
165
  // console.log(incident?.full_address);
180
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "22593 SIERRA AV, Hayward", "Should match full_address");
181
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Hayward");
166
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "801 ARNOLD WY, # 306, HALF MOON BAY CA", "Should match full_address");
167
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "HALF MOON BAY");
182
168
  }
183
169
  }
184
170
  it("process stream through legacy", async function () {
185
- const departmentId = mock.departmentAlameda._id;
171
+ const departmentId = mock.departmentCalfireCZU._id;
186
172
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
187
173
  const streamItem = lodash_1.default.first(existingStreamItems);
188
174
  if (!streamItem) {
189
- assert.fail("Expecting a stream item");
175
+ chai_1.assert.fail("Expecting a stream item");
190
176
  return;
191
177
  }
192
- const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentAlameda, atDate);
178
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentCalfireCZU, atDate);
193
179
  validateRulesResult(sut);
194
- // console.log(typeof incidentProcessor);
195
- // assert.isTrue(true);
196
180
  });
197
181
  it("process stream through correction", async function () {
198
- const departmentId = mock.departmentAlameda._id;
182
+ const departmentId = mock.departmentCalfireCZU._id;
199
183
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
200
184
  const streamItem = lodash_1.default.first(existingStreamItems);
201
185
  if (!streamItem) {
202
- assert.fail("Expecting a stream item");
186
+ chai_1.assert.fail("Expecting a stream item");
203
187
  return;
204
188
  }
205
- const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentAlameda, atDate);
189
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentCalfireCZU, atDate);
206
190
  validateRulesResult(sut);
207
- // assert.isTrue(true);
208
191
  });
209
192
  });
210
- context("Calfire CZU", function () {
193
+ context("Calfire LNU", function () {
211
194
  const atDate = new Date();
212
- const sampleIncidentNumber = "Calfire-CZU-0001";
195
+ const sampleIncidentNumber = "Calfire-LNU-0001";
213
196
  function validateRulesResult(sut) {
214
197
  if ("error" in sut) {
215
- assert.fail(sut.error.toString());
198
+ chai_1.assert.fail(sut.error.toString());
216
199
  }
217
200
  else {
218
201
  const { incident } = sut;
219
202
  // console.log(incident?.full_address);
220
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "801 ARNOLD WY, # 306, HALF MOON BAY CA", "Should match full_address");
221
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "HALF MOON BAY");
203
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "1659 ATLAS PEAK RD, NAPA CA", "Should match full_address");
204
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "NAPA");
222
205
  }
223
206
  }
224
207
  it("process stream through legacy", async function () {
225
- const departmentId = mock.departmentCalfireCZU._id;
208
+ const departmentId = mock.departmentCalfireLNU._id;
226
209
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
227
210
  const streamItem = lodash_1.default.first(existingStreamItems);
228
211
  if (!streamItem) {
229
- assert.fail("Expecting a stream item");
212
+ chai_1.assert.fail("Expecting a stream item");
230
213
  return;
231
214
  }
232
- const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentCalfireCZU, atDate);
215
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentCalfireLNU, atDate);
233
216
  validateRulesResult(sut);
234
- // console.log(typeof incidentProcessor);
235
- // assert.isTrue(true);
236
217
  });
237
218
  it("process stream through correction", async function () {
238
- const departmentId = mock.departmentCalfireCZU._id;
219
+ const departmentId = mock.departmentCalfireLNU._id;
239
220
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
240
221
  const streamItem = lodash_1.default.first(existingStreamItems);
241
222
  if (!streamItem) {
242
- assert.fail("Expecting a stream item");
223
+ chai_1.assert.fail("Expecting a stream item");
243
224
  return;
244
225
  }
245
- const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentCalfireCZU, atDate);
226
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentCalfireLNU, atDate);
246
227
  validateRulesResult(sut);
247
- // assert.isTrue(true);
248
228
  });
249
229
  });
250
- context("Calfire LNU", function () {
230
+ context("Clark County", function () {
251
231
  const atDate = new Date();
252
- const sampleIncidentNumber = "Calfire-LNU-0001";
232
+ const sampleIncidentNumber = "Clark-County-0001";
253
233
  function validateRulesResult(sut) {
254
234
  if ("error" in sut) {
255
- assert.fail(sut.error.toString());
235
+ chai_1.assert.fail(sut.error.toString());
256
236
  }
257
237
  else {
258
238
  const { incident } = sut;
259
- // console.log(incident?.full_address);
260
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "1659 ATLAS PEAK RD, NAPA CA", "Should match full_address");
261
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "NAPA");
239
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.AgencyIncidentCallTypeDescription, "P2 High F3H-Building Fire", "Should match call type description");
262
240
  }
263
241
  }
264
242
  it("process stream through legacy", async function () {
265
- const departmentId = mock.departmentCalfireLNU._id;
243
+ const department = mock.departmentClarkCounty;
244
+ const departmentId = department._id;
266
245
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
267
246
  const streamItem = lodash_1.default.first(existingStreamItems);
268
247
  if (!streamItem) {
269
- assert.fail("Expecting a stream item");
248
+ chai_1.assert.fail("Expecting a stream item");
270
249
  return;
271
250
  }
272
- const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentCalfireLNU, atDate);
251
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, department, atDate);
273
252
  validateRulesResult(sut);
274
- // console.log(typeof incidentProcessor);
275
- // assert.isTrue(true);
276
253
  });
277
254
  it("process stream through correction", async function () {
278
- const departmentId = mock.departmentCalfireLNU._id;
255
+ const department = mock.departmentClarkCounty;
256
+ const departmentId = department._id;
279
257
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
280
258
  const streamItem = lodash_1.default.first(existingStreamItems);
281
259
  if (!streamItem) {
282
- assert.fail("Expecting a stream item");
260
+ chai_1.assert.fail("Expecting a stream item");
283
261
  return;
284
262
  }
285
- const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentCalfireLNU, atDate);
263
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, department, atDate);
264
+ validateRulesResult(sut);
265
+ });
266
+ });
267
+ context("Jackson County - Testing", function () {
268
+ const atDate = new Date();
269
+ const sampleIncidentNumber = "Jackson-County-Test-0001";
270
+ function validateRulesResult(sut) {
271
+ var _a, _b;
272
+ if ("error" in sut) {
273
+ chai_1.assert.fail(sut.error.toString());
274
+ }
275
+ else {
276
+ const { incident } = sut;
277
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.AgencyIncidentCallTypeDescription, "Structure Fire - 2A", "Should match call type description");
278
+ const unitT13 = lodash_1.default.first(((_a = incident === null || incident === void 0 ? void 0 : incident.units) !== null && _a !== void 0 ? _a : []).filter((u) => u.UnitID === "T13"));
279
+ chai_1.assert.isObject(unitT13);
280
+ chai_1.assert.equal(unitT13 === null || unitT13 === void 0 ? void 0 : unitT13.AlarmAtDispatch, incident === null || incident === void 0 ? void 0 : incident.AlarmLevel);
281
+ const unitBC2 = lodash_1.default.first(((_b = incident === null || incident === void 0 ? void 0 : incident.units) !== null && _b !== void 0 ? _b : []).filter((u) => u.UnitID === "BC2"));
282
+ chai_1.assert.isObject(unitBC2);
283
+ chai_1.assert.equal(unitBC2 === null || unitBC2 === void 0 ? void 0 : unitBC2.AlarmAtDispatch, "1");
284
+ }
285
+ }
286
+ it("process stream through legacy", async function () {
287
+ const department = mock.departmentJacksonCountyTest;
288
+ const departmentId = department._id;
289
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
290
+ const streamItem = lodash_1.default.first(existingStreamItems);
291
+ if (!streamItem) {
292
+ chai_1.assert.fail("Expecting a stream item");
293
+ return;
294
+ }
295
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, department, atDate);
296
+ validateRulesResult(sut);
297
+ });
298
+ it("process stream through correction", async function () {
299
+ const department = mock.departmentJacksonCountyTest;
300
+ const departmentId = department._id;
301
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
302
+ const streamItem = lodash_1.default.first(existingStreamItems);
303
+ if (!streamItem) {
304
+ chai_1.assert.fail("Expecting a stream item");
305
+ return;
306
+ }
307
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, department, atDate);
308
+ validateRulesResult(sut);
309
+ });
310
+ });
311
+ context("San Mateo County", function () {
312
+ const atDate = new Date();
313
+ const sampleIncidentNumber = "San-Mateo-0001";
314
+ function validateRulesResult(sut) {
315
+ var _a, _b;
316
+ if ("error" in sut) {
317
+ chai_1.assert.fail(sut.error.toString());
318
+ }
319
+ else {
320
+ const { incident } = sut;
321
+ // console.log(incident);
322
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.FireMap, "");
323
+ const unitT9 = lodash_1.default.first(((_a = incident === null || incident === void 0 ? void 0 : incident.units) !== null && _a !== void 0 ? _a : []).filter((u) => u.UnitID === "T9"));
324
+ chai_1.assert.isObject(unitT9, "Expecting unit T9");
325
+ chai_1.assert.strictEqual(unitT9 === null || unitT9 === void 0 ? void 0 : unitT9.Personnel.length, 6);
326
+ chai_1.assert.strictEqual(unitT9 === null || unitT9 === void 0 ? void 0 : unitT9.PersonnelCount, 6);
327
+ chai_1.assert.strictEqual(incident === null || incident === void 0 ? void 0 : incident.TacticalChannel, "TAC15");
328
+ chai_1.assert.strictEqual(incident === null || incident === void 0 ? void 0 : incident.CommandChannel, "CM41X3");
329
+ const noDateComment = lodash_1.default.first(((_b = incident === null || incident === void 0 ? void 0 : incident.Comment) !== null && _b !== void 0 ? _b : []).filter((c) => c.CommentSource === "no-date-source"));
330
+ chai_1.assert.isObject(noDateComment);
331
+ chai_1.assert.equal(noDateComment === null || noDateComment === void 0 ? void 0 : noDateComment.CommentDateTime, "2000-01-01T19:04:05-0800");
332
+ }
333
+ }
334
+ it("process stream through legacy", async function () {
335
+ const departmentId = mock.departmentSanMateoCounty._id;
336
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
337
+ const streamItem = lodash_1.default.first(existingStreamItems);
338
+ if (!streamItem) {
339
+ chai_1.assert.fail("Expecting a stream item");
340
+ return;
341
+ }
342
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentSanMateoCounty, atDate);
343
+ validateRulesResult(sut);
344
+ });
345
+ it("process stream through correction", async function () {
346
+ const departmentId = mock.departmentSanMateoCounty._id;
347
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
348
+ const streamItem = lodash_1.default.first(existingStreamItems);
349
+ if (!streamItem) {
350
+ chai_1.assert.fail("Expecting a stream item");
351
+ return;
352
+ }
353
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentSanMateoCounty, atDate);
354
+ validateRulesResult(sut);
355
+ });
356
+ });
357
+ context("Santa Cruz Regional Communications", function () {
358
+ const atDate = new Date();
359
+ const sampleIncidentNumber = "Santa-Cruz-Regional-0001";
360
+ function validateRulesResult(sut) {
361
+ if ("error" in sut) {
362
+ chai_1.assert.fail(sut.error.toString());
363
+ }
364
+ else {
365
+ const { incident } = sut;
366
+ chai_1.assert.strictEqual(incident === null || incident === void 0 ? void 0 : incident.TacticalChannel, "FBLK/FBLK2/FORNG");
367
+ chai_1.assert.strictEqual(incident === null || incident === void 0 ? void 0 : incident.CommandChannel, "FRED1/FCZU");
368
+ }
369
+ }
370
+ it("process stream through legacy", async function () {
371
+ const departmentId = mock.departmentSantaCruzRegional._id;
372
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
373
+ const streamItem = lodash_1.default.first(existingStreamItems);
374
+ if (!streamItem) {
375
+ chai_1.assert.fail("Expecting a stream item");
376
+ return;
377
+ }
378
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentSantaCruzRegional, atDate);
379
+ validateRulesResult(sut);
380
+ });
381
+ it("process stream through correction", async function () {
382
+ const departmentId = mock.departmentSantaCruzRegional._id;
383
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
384
+ const streamItem = lodash_1.default.first(existingStreamItems);
385
+ if (!streamItem) {
386
+ chai_1.assert.fail("Expecting a stream item");
387
+ return;
388
+ }
389
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentSantaCruzRegional, atDate);
390
+ validateRulesResult(sut);
391
+ });
392
+ });
393
+ context("Southern Marin", function () {
394
+ const atDate = new Date();
395
+ const sampleIncidentNumber = "Southern-Marin-0001";
396
+ function validateRulesResult(sut) {
397
+ var _a, _b;
398
+ if ("error" in sut) {
399
+ chai_1.assert.fail(sut.error.toString());
400
+ }
401
+ else {
402
+ const { incident } = sut;
403
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "190 BARN AVE, BLDG: B22 # S1, Fairfax", "Should match full_address");
404
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Fairfax");
405
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.FireMap, "ROT_31");
406
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.ClosedDateTime, "");
407
+ chai_1.assert.isNotNull(incident === null || incident === void 0 ? void 0 : incident.expiration_date, "Should have expiration date");
408
+ const u10 = lodash_1.default.first(((_a = incident === null || incident === void 0 ? void 0 : incident.units) !== null && _a !== void 0 ? _a : []).filter((u) => u.UnitID === "M10"));
409
+ chai_1.assert.isObject(u10);
410
+ chai_1.assert.isArray(u10 === null || u10 === void 0 ? void 0 : u10.Personnel);
411
+ chai_1.assert.equal((_b = u10 === null || u10 === void 0 ? void 0 : u10.Personnel) === null || _b === void 0 ? void 0 : _b.length, 0);
412
+ }
413
+ }
414
+ it("process stream through legacy", async function () {
415
+ const departmentId = mock.departmentSouthernMarin._id;
416
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
417
+ const streamItem = lodash_1.default.first(existingStreamItems);
418
+ if (!streamItem) {
419
+ chai_1.assert.fail("Expecting a stream item");
420
+ return;
421
+ }
422
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentSouthernMarin, atDate);
423
+ validateRulesResult(sut);
424
+ });
425
+ it("process stream through correction", async function () {
426
+ const departmentId = mock.departmentSouthernMarin._id;
427
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
428
+ const streamItem = lodash_1.default.first(existingStreamItems);
429
+ if (!streamItem) {
430
+ chai_1.assert.fail("Expecting a stream item");
431
+ return;
432
+ }
433
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentSouthernMarin, atDate);
286
434
  validateRulesResult(sut);
287
- // assert.isTrue(true);
288
435
  });
289
436
  });
290
437
  context("Verdugo", function () {
@@ -292,13 +439,13 @@ describe("index", function () {
292
439
  const sampleIncidentNumber = "Verdugo-0001";
293
440
  function validateRulesResult(sut) {
294
441
  if ("error" in sut) {
295
- assert.fail(sut.error.toString());
442
+ chai_1.assert.fail(sut.error.toString());
296
443
  }
297
444
  else {
298
445
  const { incident } = sut;
299
446
  // console.log(incident?.full_address);
300
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "2019 E VILLA ST, Pasadena CA", "Should match full_address");
301
- assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Pasadena");
447
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.full_address, "2019 E VILLA ST, Pasadena CA", "Should match full_address");
448
+ chai_1.assert.equal(incident === null || incident === void 0 ? void 0 : incident.CityOrLocality, "Pasadena");
302
449
  }
303
450
  }
304
451
  it("process stream through legacy", async function () {
@@ -306,25 +453,59 @@ describe("index", function () {
306
453
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
307
454
  const streamItem = lodash_1.default.first(existingStreamItems);
308
455
  if (!streamItem) {
309
- assert.fail("Expecting a stream item");
456
+ chai_1.assert.fail("Expecting a stream item");
310
457
  return;
311
458
  }
312
459
  const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, mock.departmentVerdugo, atDate);
313
460
  validateRulesResult(sut);
314
- // console.log(typeof incidentProcessor);
315
- // assert.isTrue(true);
316
461
  });
317
462
  it("process stream through correction", async function () {
318
463
  const departmentId = mock.departmentVerdugo._id;
319
464
  const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
320
465
  const streamItem = lodash_1.default.first(existingStreamItems);
321
466
  if (!streamItem) {
322
- assert.fail("Expecting a stream item");
467
+ chai_1.assert.fail("Expecting a stream item");
323
468
  return;
324
469
  }
325
470
  const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, mock.departmentVerdugo, atDate);
326
471
  validateRulesResult(sut);
327
- // assert.isTrue(true);
472
+ });
473
+ });
474
+ context("Yolo Emergency Communications Agency", function () {
475
+ const atDate = new Date();
476
+ const sampleIncidentNumber = "Yolo-Communications-0001";
477
+ function validateRulesResult(sut) {
478
+ if ("error" in sut) {
479
+ chai_1.assert.fail(sut.error.toString());
480
+ }
481
+ else {
482
+ const { incident } = sut;
483
+ chai_1.assert.strictEqual(incident === null || incident === void 0 ? void 0 : incident.TacticalChannel, "BROWN/ECHO6/VFIRE25");
484
+ }
485
+ }
486
+ it("process stream through legacy", async function () {
487
+ const department = mock.departmentYolo;
488
+ const departmentId = department._id;
489
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
490
+ const streamItem = lodash_1.default.first(existingStreamItems);
491
+ if (!streamItem) {
492
+ chai_1.assert.fail("Expecting a stream item");
493
+ return;
494
+ }
495
+ const sut = await incidentProcessor.handleProcessIncidentRequestLegacy(streamItem, department, atDate);
496
+ validateRulesResult(sut);
497
+ });
498
+ it("process stream through correction", async function () {
499
+ const department = mock.departmentYolo;
500
+ const departmentId = department._id;
501
+ const existingStreamItems = await mock.getIncidentStreamItems(departmentId, sampleIncidentNumber);
502
+ const streamItem = lodash_1.default.first(existingStreamItems);
503
+ if (!streamItem) {
504
+ chai_1.assert.fail("Expecting a stream item");
505
+ return;
506
+ }
507
+ const sut = await incidentProcessor.handleProcessIncidentRequestCorrection(streamItem.incidentNumber, department, atDate);
508
+ validateRulesResult(sut);
328
509
  });
329
510
  });
330
511
  });