tabletcommand-backend-models 7.4.81 → 7.4.83

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 (281) hide show
  1. package/build/models/chart-incident.js +0 -6
  2. package/build/models/chart-incident.js.map +1 -1
  3. package/build/models/chart-managed-incident.js +0 -6
  4. package/build/models/chart-managed-incident.js.map +1 -1
  5. package/build/models/chart-user.js +0 -6
  6. package/build/models/chart-user.js.map +1 -1
  7. package/build/models/department.js +4 -0
  8. package/build/models/department.js.map +1 -1
  9. package/build/test/0index.js +5 -6
  10. package/build/test/0index.js.map +1 -1
  11. package/build/test/action-log.js +6 -5
  12. package/build/test/action-log.js.map +1 -1
  13. package/build/test/adsb.js +5 -5
  14. package/build/test/adsb.js.map +1 -1
  15. package/build/test/agency.js +5 -5
  16. package/build/test/agency.js.map +1 -1
  17. package/build/test/arcgis-group.js +6 -6
  18. package/build/test/arcgis-group.js.map +1 -1
  19. package/build/test/assignment.js +6 -5
  20. package/build/test/assignment.js.map +1 -1
  21. package/build/test/audio-stream-authentication.js +8 -8
  22. package/build/test/audio-stream-authentication.js.map +1 -1
  23. package/build/test/audio-stream.js +10 -9
  24. package/build/test/audio-stream.js.map +1 -1
  25. package/build/test/battalion.js +6 -5
  26. package/build/test/battalion.js.map +1 -1
  27. package/build/test/cad-incident-block.js +5 -5
  28. package/build/test/cad-incident-block.js.map +1 -1
  29. package/build/test/cad-incident.js +6 -6
  30. package/build/test/cad-incident.js.map +1 -1
  31. package/build/test/cad-simulation.js +6 -5
  32. package/build/test/cad-simulation.js.map +1 -1
  33. package/build/test/cad-status-map.js +6 -5
  34. package/build/test/cad-status-map.js.map +1 -1
  35. package/build/test/cad-status.js +6 -5
  36. package/build/test/cad-status.js.map +1 -1
  37. package/build/test/cad-vehicle-status-history.js +6 -5
  38. package/build/test/cad-vehicle-status-history.js.map +1 -1
  39. package/build/test/cad-vehicle-status.js +6 -5
  40. package/build/test/cad-vehicle-status.js.map +1 -1
  41. package/build/test/cad-vehicle.js +6 -5
  42. package/build/test/cad-vehicle.js.map +1 -1
  43. package/build/test/chart-incident.js +5 -5
  44. package/build/test/chart-incident.js.map +1 -1
  45. package/build/test/chart-managed-incident.js +6 -6
  46. package/build/test/chart-managed-incident.js.map +1 -1
  47. package/build/test/chart-user.js +6 -6
  48. package/build/test/chart-user.js.map +1 -1
  49. package/build/test/checklist-item.js +6 -5
  50. package/build/test/checklist-item.js.map +1 -1
  51. package/build/test/checklist.js +6 -5
  52. package/build/test/checklist.js.map +1 -1
  53. package/build/test/config.js +30 -3
  54. package/build/test/config.js.map +1 -1
  55. package/build/test/csv-import.js +6 -5
  56. package/build/test/csv-import.js.map +1 -1
  57. package/build/test/department.js +9 -8
  58. package/build/test/department.js.map +1 -1
  59. package/build/test/device-mapping.js +7 -6
  60. package/build/test/device-mapping.js.map +1 -1
  61. package/build/test/esri.js +6 -6
  62. package/build/test/esri.js.map +1 -1
  63. package/build/test/global-settings.js +6 -6
  64. package/build/test/global-settings.js.map +1 -1
  65. package/build/test/gst-mapping.js +6 -5
  66. package/build/test/gst-mapping.js.map +1 -1
  67. package/build/test/helpers.js +3 -3
  68. package/build/test/helpers.js.map +1 -1
  69. package/build/test/incident-event.js +6 -8
  70. package/build/test/incident-event.js.map +1 -1
  71. package/build/test/incident-filter.js +6 -5
  72. package/build/test/incident-filter.js.map +1 -1
  73. package/build/test/incident-notified.js +6 -5
  74. package/build/test/incident-notified.js.map +1 -1
  75. package/build/test/incident-takeover.js +6 -5
  76. package/build/test/incident-takeover.js.map +1 -1
  77. package/build/test/job-log.js +6 -5
  78. package/build/test/job-log.js.map +1 -1
  79. package/build/test/location.js +6 -6
  80. package/build/test/location.js.map +1 -1
  81. package/build/test/mail-log.js +6 -5
  82. package/build/test/mail-log.js.map +1 -1
  83. package/build/test/managed-incident.js +6 -5
  84. package/build/test/managed-incident.js.map +1 -1
  85. package/build/test/mark43-incident-retry.js +6 -5
  86. package/build/test/mark43-incident-retry.js.map +1 -1
  87. package/build/test/message.js +6 -5
  88. package/build/test/message.js.map +1 -1
  89. package/build/test/monitor.js +6 -5
  90. package/build/test/monitor.js.map +1 -1
  91. package/build/test/partner.js +6 -5
  92. package/build/test/partner.js.map +1 -1
  93. package/build/test/personnel-import.js +6 -5
  94. package/build/test/personnel-import.js.map +1 -1
  95. package/build/test/rate-limit.js +6 -5
  96. package/build/test/rate-limit.js.map +1 -1
  97. package/build/test/release-note.js +6 -5
  98. package/build/test/release-note.js.map +1 -1
  99. package/build/test/saml.js +5 -5
  100. package/build/test/saml.js.map +1 -1
  101. package/build/test/session.js +6 -5
  102. package/build/test/session.js.map +1 -1
  103. package/build/test/template.js +6 -5
  104. package/build/test/template.js.map +1 -1
  105. package/build/test/user-device.js +6 -5
  106. package/build/test/user-device.js.map +1 -1
  107. package/build/test/user-registration.js +6 -5
  108. package/build/test/user-registration.js.map +1 -1
  109. package/build/test/user.js +6 -4
  110. package/build/test/user.js.map +1 -1
  111. package/build/test/validation-report.js +6 -5
  112. package/build/test/validation-report.js.map +1 -1
  113. package/definitions/models/chart-incident.d.ts.map +1 -1
  114. package/definitions/models/chart-managed-incident.d.ts.map +1 -1
  115. package/definitions/models/chart-user.d.ts.map +1 -1
  116. package/definitions/models/department.d.ts.map +1 -1
  117. package/definitions/test/0index.d.ts +1 -1
  118. package/definitions/test/0index.d.ts.map +1 -1
  119. package/definitions/test/action-log.d.ts +1 -1
  120. package/definitions/test/action-log.d.ts.map +1 -1
  121. package/definitions/test/adsb.d.ts +1 -1
  122. package/definitions/test/adsb.d.ts.map +1 -1
  123. package/definitions/test/agency.d.ts +1 -1
  124. package/definitions/test/agency.d.ts.map +1 -1
  125. package/definitions/test/arcgis-group.d.ts +1 -1
  126. package/definitions/test/arcgis-group.d.ts.map +1 -1
  127. package/definitions/test/assignment.d.ts +1 -1
  128. package/definitions/test/assignment.d.ts.map +1 -1
  129. package/definitions/test/audio-stream-authentication.d.ts +1 -1
  130. package/definitions/test/audio-stream-authentication.d.ts.map +1 -1
  131. package/definitions/test/audio-stream.d.ts +1 -1
  132. package/definitions/test/audio-stream.d.ts.map +1 -1
  133. package/definitions/test/battalion.d.ts +1 -1
  134. package/definitions/test/battalion.d.ts.map +1 -1
  135. package/definitions/test/cad-incident-block.d.ts +1 -1
  136. package/definitions/test/cad-incident-block.d.ts.map +1 -1
  137. package/definitions/test/cad-incident.d.ts +1 -1
  138. package/definitions/test/cad-incident.d.ts.map +1 -1
  139. package/definitions/test/cad-simulation.d.ts +1 -1
  140. package/definitions/test/cad-simulation.d.ts.map +1 -1
  141. package/definitions/test/cad-status-map.d.ts +1 -1
  142. package/definitions/test/cad-status-map.d.ts.map +1 -1
  143. package/definitions/test/cad-status.d.ts +1 -1
  144. package/definitions/test/cad-status.d.ts.map +1 -1
  145. package/definitions/test/cad-vehicle-status-history.d.ts +1 -1
  146. package/definitions/test/cad-vehicle-status-history.d.ts.map +1 -1
  147. package/definitions/test/cad-vehicle-status.d.ts +1 -1
  148. package/definitions/test/cad-vehicle-status.d.ts.map +1 -1
  149. package/definitions/test/cad-vehicle.d.ts +1 -1
  150. package/definitions/test/cad-vehicle.d.ts.map +1 -1
  151. package/definitions/test/chart-incident.d.ts +1 -1
  152. package/definitions/test/chart-incident.d.ts.map +1 -1
  153. package/definitions/test/chart-managed-incident.d.ts +1 -1
  154. package/definitions/test/chart-managed-incident.d.ts.map +1 -1
  155. package/definitions/test/chart-user.d.ts +1 -1
  156. package/definitions/test/chart-user.d.ts.map +1 -1
  157. package/definitions/test/checklist-item.d.ts +1 -1
  158. package/definitions/test/checklist-item.d.ts.map +1 -1
  159. package/definitions/test/checklist.d.ts +1 -1
  160. package/definitions/test/checklist.d.ts.map +1 -1
  161. package/definitions/test/config.d.ts +2 -1
  162. package/definitions/test/config.d.ts.map +1 -1
  163. package/definitions/test/csv-import.d.ts +1 -1
  164. package/definitions/test/csv-import.d.ts.map +1 -1
  165. package/definitions/test/department.d.ts +1 -1
  166. package/definitions/test/department.d.ts.map +1 -1
  167. package/definitions/test/device-mapping.d.ts +1 -1
  168. package/definitions/test/device-mapping.d.ts.map +1 -1
  169. package/definitions/test/esri.d.ts +1 -1
  170. package/definitions/test/esri.d.ts.map +1 -1
  171. package/definitions/test/global-settings.d.ts +1 -1
  172. package/definitions/test/global-settings.d.ts.map +1 -1
  173. package/definitions/test/gst-mapping.d.ts +1 -1
  174. package/definitions/test/gst-mapping.d.ts.map +1 -1
  175. package/definitions/test/helpers.d.ts +1 -1
  176. package/definitions/test/helpers.d.ts.map +1 -1
  177. package/definitions/test/incident-event.d.ts +1 -1
  178. package/definitions/test/incident-event.d.ts.map +1 -1
  179. package/definitions/test/incident-filter.d.ts +1 -1
  180. package/definitions/test/incident-filter.d.ts.map +1 -1
  181. package/definitions/test/incident-notified.d.ts +1 -1
  182. package/definitions/test/incident-notified.d.ts.map +1 -1
  183. package/definitions/test/incident-takeover.d.ts +1 -1
  184. package/definitions/test/incident-takeover.d.ts.map +1 -1
  185. package/definitions/test/job-log.d.ts +1 -1
  186. package/definitions/test/job-log.d.ts.map +1 -1
  187. package/definitions/test/location.d.ts +1 -1
  188. package/definitions/test/location.d.ts.map +1 -1
  189. package/definitions/test/mail-log.d.ts +1 -1
  190. package/definitions/test/mail-log.d.ts.map +1 -1
  191. package/definitions/test/managed-incident.d.ts +1 -1
  192. package/definitions/test/managed-incident.d.ts.map +1 -1
  193. package/definitions/test/mark43-incident-retry.d.ts +1 -1
  194. package/definitions/test/mark43-incident-retry.d.ts.map +1 -1
  195. package/definitions/test/message.d.ts +1 -1
  196. package/definitions/test/message.d.ts.map +1 -1
  197. package/definitions/test/monitor.d.ts +1 -1
  198. package/definitions/test/monitor.d.ts.map +1 -1
  199. package/definitions/test/partner.d.ts +1 -1
  200. package/definitions/test/partner.d.ts.map +1 -1
  201. package/definitions/test/personnel-import.d.ts +1 -1
  202. package/definitions/test/personnel-import.d.ts.map +1 -1
  203. package/definitions/test/rate-limit.d.ts +1 -1
  204. package/definitions/test/rate-limit.d.ts.map +1 -1
  205. package/definitions/test/release-note.d.ts +1 -1
  206. package/definitions/test/release-note.d.ts.map +1 -1
  207. package/definitions/test/saml.d.ts +1 -1
  208. package/definitions/test/saml.d.ts.map +1 -1
  209. package/definitions/test/session.d.ts +1 -1
  210. package/definitions/test/session.d.ts.map +1 -1
  211. package/definitions/test/template.d.ts +1 -1
  212. package/definitions/test/template.d.ts.map +1 -1
  213. package/definitions/test/user-device.d.ts +1 -1
  214. package/definitions/test/user-device.d.ts.map +1 -1
  215. package/definitions/test/user-registration.d.ts +1 -1
  216. package/definitions/test/user-registration.d.ts.map +1 -1
  217. package/definitions/test/validation-report.d.ts +1 -1
  218. package/definitions/test/validation-report.d.ts.map +1 -1
  219. package/definitions/types/department.d.ts +1 -0
  220. package/definitions/types/department.d.ts.map +1 -1
  221. package/eslint.config.mjs +20 -6
  222. package/gulpfile.js +1 -1
  223. package/package.json +9 -11
  224. package/src/models/chart-incident.ts +0 -7
  225. package/src/models/chart-managed-incident.ts +0 -7
  226. package/src/models/chart-user.ts +0 -7
  227. package/src/models/department.ts +4 -0
  228. package/src/test/0index.ts +1 -2
  229. package/src/test/action-log.ts +2 -1
  230. package/src/test/adsb.ts +1 -1
  231. package/src/test/agency.ts +1 -1
  232. package/src/test/arcgis-group.ts +2 -2
  233. package/src/test/assignment.ts +2 -1
  234. package/src/test/audio-stream-authentication.ts +2 -3
  235. package/src/test/audio-stream.ts +3 -3
  236. package/src/test/battalion.ts +2 -1
  237. package/src/test/cad-incident-block.ts +1 -1
  238. package/src/test/cad-incident.ts +1 -1
  239. package/src/test/cad-simulation.ts +2 -1
  240. package/src/test/cad-status-map.ts +2 -1
  241. package/src/test/cad-status.ts +2 -1
  242. package/src/test/cad-vehicle-status-history.ts +2 -1
  243. package/src/test/cad-vehicle-status.ts +2 -1
  244. package/src/test/cad-vehicle.ts +2 -1
  245. package/src/test/chart-incident.ts +1 -1
  246. package/src/test/chart-managed-incident.ts +1 -1
  247. package/src/test/chart-user.ts +1 -1
  248. package/src/test/checklist-item.ts +2 -1
  249. package/src/test/checklist.ts +2 -1
  250. package/src/test/config.ts +28 -1
  251. package/src/test/csv-import.ts +2 -1
  252. package/src/test/department.ts +3 -2
  253. package/src/test/device-mapping.ts +2 -1
  254. package/src/test/esri.ts +2 -2
  255. package/src/test/global-settings.ts +2 -2
  256. package/src/test/gst-mapping.ts +2 -1
  257. package/src/test/helpers.ts +1 -3
  258. package/src/test/incident-event.ts +2 -4
  259. package/src/test/incident-filter.ts +2 -1
  260. package/src/test/incident-notified.ts +2 -1
  261. package/src/test/incident-takeover.ts +2 -1
  262. package/src/test/job-log.ts +2 -1
  263. package/src/test/location.ts +1 -1
  264. package/src/test/mail-log.ts +2 -1
  265. package/src/test/managed-incident.ts +2 -1
  266. package/src/test/mark43-incident-retry.ts +2 -1
  267. package/src/test/message.ts +2 -1
  268. package/src/test/monitor.ts +2 -1
  269. package/src/test/partner.ts +2 -1
  270. package/src/test/personnel-import.ts +2 -1
  271. package/src/test/rate-limit.ts +2 -1
  272. package/src/test/release-note.ts +2 -1
  273. package/src/test/saml.ts +1 -1
  274. package/src/test/session.ts +2 -1
  275. package/src/test/template.ts +2 -1
  276. package/src/test/user-device.ts +2 -1
  277. package/src/test/user-registration.ts +2 -1
  278. package/src/test/user.ts +2 -0
  279. package/src/test/validation-report.ts +2 -1
  280. package/src/tsconfig.json +3 -3
  281. package/src/types/department.ts +1 -0
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "tabletcommand-backend-models",
3
- "version": "7.4.81",
3
+ "version": "7.4.83",
4
4
  "description": "Tablet Command Backend Models",
5
5
  "scripts": {
6
6
  "lint": "eslint src",
7
7
  "build": "gulp build",
8
- "test": "ts-mocha -p src --reporter list --recursive --extension ts src/test"
8
+ "test": "tsx --test --test-concurrency=1 --test-reporter=spec src/test/*.ts"
9
9
  },
10
10
  "author": "Marius Ursache <marius@tabletcommand.com>",
11
11
  "license": "MIT",
@@ -28,22 +28,20 @@
28
28
  "@eslint/js": "^9.39.4",
29
29
  "@types/chai": "^5.2.3",
30
30
  "@types/lodash": "^4.17.24",
31
- "@types/mocha": "^10.0.10",
32
- "@types/node": "^24.12.2",
33
- "@typescript-eslint/eslint-plugin": "~8.59.0",
34
- "@typescript-eslint/parser": "~8.59.0",
31
+ "@types/node": "^24.12.4",
32
+ "@typescript-eslint/eslint-plugin": "~8.59.3",
33
+ "@typescript-eslint/parser": "~8.59.3",
35
34
  "chai": "^6.2.2",
36
35
  "cspell": "^10.0.0",
37
36
  "del": "^8.0.1",
38
37
  "eslint": "^9.39.4",
39
- "globals": "^17.5.0",
38
+ "eslint-plugin-promise": "^7.3.0",
39
+ "eslint-plugin-security": "^4.0.0",
40
+ "globals": "^17.6.0",
40
41
  "gulp": "^5.0.1",
41
42
  "gulp-execa": "^8.0.1",
42
- "mocha": "^11.7.5",
43
43
  "neostandard": "^0.13.0",
44
- "ts-mocha": "^11.1.0",
45
- "ts-node": "^10.9.2",
46
- "tsconfig-paths": "^4.2.0",
44
+ "tsx": "^4.21.0",
47
45
  "type-coverage": "^2.29.7",
48
46
  "typescript": "~5.9.3"
49
47
  },
@@ -54,13 +54,6 @@ export default async function ChartIncidentModule(mongoose: MongooseModule) {
54
54
  }
55
55
  });
56
56
 
57
- modelSchema.index({
58
- departmentId: 1,
59
- date: 1,
60
- }, {
61
- name: "departmentId1_date_1",
62
- });
63
-
64
57
  modelSchema.index({
65
58
  departmentId: 1,
66
59
  dateAt: -1
@@ -79,13 +79,6 @@ export default async function ChartManagedIncidentModule(mongoose: MongooseModul
79
79
  name: "departmentId_1_dateAt_-1",
80
80
  });
81
81
 
82
- modelSchema.index({
83
- departmentId: 1,
84
- date: 1,
85
- }, {
86
- name: "departmentId_1_date_1",
87
- });
88
-
89
82
  modelSchema.index({
90
83
  departmentId: 1,
91
84
  userId: 1,
@@ -59,13 +59,6 @@ export default async function ChartUserModule(mongoose: MongooseModule) {
59
59
  name: "departmentId_1_dateAt_-1",
60
60
  });
61
61
 
62
- modelSchema.index({
63
- departmentId: 1,
64
- date: 1,
65
- }, {
66
- name: "departmentId_1_date_1",
67
- });
68
-
69
62
  modelSchema.index({
70
63
  departmentId: 1,
71
64
  agencyId: 1,
@@ -802,6 +802,10 @@ export default async function DepartmentModule(mongoose: MongooseModule) {
802
802
  type: String,
803
803
  default: "",
804
804
  },
805
+ authHeader: {
806
+ type: String,
807
+ default: "",
808
+ },
805
809
  authUser: {
806
810
  type: String,
807
811
  default: "",
@@ -1,6 +1,5 @@
1
- import "mocha";
2
- // Check for a mocha config file where we can import those
3
1
  import { assert } from "chai";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
4
3
  import * as m from "../index";
5
4
  import * as config from "./config";
6
5
 
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("ActionLog", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.actionLog;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
package/src/test/adsb.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import { LocationKindType } from "../constants";
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as _ from "lodash";
4
4
  import * as m from "../index";
5
5
  import * as config from "./config";
@@ -17,7 +17,7 @@ describe("ArcGISGroup", function() {
17
17
  mongoose
18
18
  });
19
19
  testItem = mock.arcGISGroup;
20
- await mock.cleanup();
20
+ await mock.beforeEach();
21
21
  });
22
22
 
23
23
  afterEach(async function() {
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("Assignment", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.assignment;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,6 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
3
-
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
4
3
  import * as m from "../index";
5
4
  import * as config from "./config";
6
5
  import mockModule from "./mock";
@@ -16,7 +15,7 @@ describe("AudioStreamAuthentication", function() {
16
15
  mongoose
17
16
  });
18
17
  testItem = mock.audioStreamAuthentication;
19
- await mock.cleanup();
18
+ await mock.beforeEach();
20
19
  });
21
20
 
22
21
  afterEach(async function() {
@@ -1,6 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
3
-
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
4
3
  import * as m from "../index";
5
4
  import * as config from "./config";
6
5
  import mockModule from "./mock";
@@ -16,8 +15,9 @@ describe("AudioStream", function() {
16
15
  const mock = mockModule({
17
16
  mongoose
18
17
  });
19
- await mock.cleanup();
18
+ await mock.beforeEach();
20
19
 
20
+ // TODO: Move to mock (?)
21
21
  // Create an AudioStreamAuthentication record to reference
22
22
  const authItem = new models.AudioStreamAuthentication({
23
23
  name: "test-auth-record",
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("Battalion", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.battalion;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as _ from "lodash";
4
4
  import * as m from "../index";
5
5
  import * as config from "./config";
@@ -1,9 +1,9 @@
1
1
  import { assert } from "chai";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
2
3
  import * as _ from "lodash";
3
4
  import * as m from "../index";
4
5
  import * as config from "./config";
5
6
  import mockModule from "./mock";
6
- import "mocha";
7
7
 
8
8
  describe("CADIncident", function() {
9
9
  let models: m.BackendModels, mongoose: m.MongooseModule;
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CadSimulation", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadSimulation;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CADStatusMap", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadStatusMap;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CADStatus", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadStatus;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CADVehicleStatusHistory", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadVehicleStatusHistory;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CADVehicleStatus", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadVehicleStatus;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CADVehicle", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.cadVehicle;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("ChecklistItem", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.checklistItem;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("Checklist", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.checklist;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,6 +1,31 @@
1
- export const url = process.env.NODE_MONGO_URL || "";
1
+ // By default, node:test runs with in parallel, make sure each thread gets their own database
2
+ export function getTestMongoUrl(dbName = "massive-test-models") {
3
+ const urlString = process.env.NODE_MONGO_URL || "";
4
+ const workerId = process.env.NODE_TEST_WORKER_ID || "1";
5
+ // Legacy mode, when running only one worker id, keep the provided URL, otherwise append _1, _2, etc
6
+ if (workerId === "1") {
7
+ return urlString;
8
+ }
9
+
10
+ try {
11
+ const url = new URL(urlString);
12
+ let dbN = url.pathname.slice(1);
13
+ if (!dbN) {
14
+ dbN = dbName;
15
+ }
16
+ while (dbN.match(/-\d+$/)) {
17
+ dbN = dbN.replace(/-\d+$/, "");
18
+ }
19
+ url.pathname = `/${dbN}-${workerId}`;
20
+ return url.toString();
21
+ } catch (e) {
22
+ console.error("[Mocha Setup] Invalid NODE_MONGO_URL", e);
23
+ return urlString;
24
+ }
25
+ }
2
26
 
3
27
  export function checkIfTestDatabase() {
28
+ const url = getTestMongoUrl();
4
29
  if (!/massive-test/i.exec(url)) {
5
30
  console.log(`Not a test database: ${url}? Expecting database: massive-test.`);
6
31
  process.exit(1);
@@ -8,3 +33,5 @@ export function checkIfTestDatabase() {
8
33
  }
9
34
 
10
35
  checkIfTestDatabase();
36
+
37
+ export const url = getTestMongoUrl();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("CSVImport", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.csvImport;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -25,7 +25,7 @@ describe("Department", function () {
25
25
  mongoose
26
26
  });
27
27
  testItem = mock.department;
28
- await mock.cleanup();
28
+ await mock.beforeEach();
29
29
  });
30
30
 
31
31
  afterEach(async function () {
@@ -153,6 +153,7 @@ describe("Department", function () {
153
153
  forwardAll: false,
154
154
  apiUrl: "https://eso.example.com/soap",
155
155
  authType: "basic",
156
+ authHeader: "",
156
157
  authUser: "user",
157
158
  authKey: "pass",
158
159
  authKeySecret: "",
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -17,6 +17,7 @@ describe("DeviceMapping", function() {
17
17
  });
18
18
  testItem = mock.deviceMapping;
19
19
  testItemForTrim = mock.deviceMappingWithWhiteSpaces;
20
+ await mock.beforeEach();
20
21
  });
21
22
  afterEach(async function() {
22
23
  await mongoose.disconnect();
package/src/test/esri.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -14,7 +14,7 @@ describe("Esri", function() {
14
14
  mongoose
15
15
  });
16
16
  testItem = mock.esri;
17
- await mock.cleanup();
17
+ await mock.beforeEach();
18
18
  });
19
19
 
20
20
  afterEach(async function() {
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import { isDate } from "lodash";
4
4
 
5
5
  import * as m from "../index";
@@ -17,7 +17,7 @@ describe("GlobalSettings", function() {
17
17
  mongoose
18
18
  });
19
19
  testItem = mock.globalSettings;
20
- await mock.cleanup();
20
+ await mock.beforeEach();
21
21
  });
22
22
 
23
23
  afterEach(async function() {
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("GSTMapping", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.gstMapping;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,7 +1,5 @@
1
- "use strict";
2
-
3
1
  import { assert } from "chai";
4
- import "mocha";
2
+ import { describe, it } from "node:test";
5
3
  import * as m from "../helpers";
6
4
 
7
5
  describe("helpers", function() {
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,9 +16,7 @@ describe("IncidentEvent", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.incidentEvent;
19
- await models.IncidentEvent.deleteMany({
20
- departmentId: testItem.departmentId
21
- });
19
+ await mock.beforeEach();
22
20
  });
23
21
  afterEach(async function() {
24
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import { url } from "./config";
5
5
  import mockModule from "./mock";
@@ -15,6 +15,7 @@ describe("IncidentFilter", function() {
15
15
  mongoose
16
16
  });
17
17
  testItem = mock.incidentFilterAgency;
18
+ await mock.beforeEach();
18
19
  });
19
20
 
20
21
  afterEach(async function() {
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("IncidentNotified", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.incidentNotified;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("IncidentTakeover", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.incidentTakeover;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("JobLog", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.jobLog;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -1,5 +1,5 @@
1
1
  import { assert } from "chai";
2
- import "mocha";
2
+ import { describe, it, beforeEach, afterEach } from "node:test";
3
3
  import * as m from "../index";
4
4
  import * as config from "./config";
5
5
  import mockModule from "./mock";
@@ -16,6 +16,7 @@ describe("MailLog", function() {
16
16
  mongoose
17
17
  });
18
18
  testItem = mock.mailLog;
19
+ await mock.beforeEach();
19
20
  });
20
21
  afterEach(async function() {
21
22
  await mongoose.disconnect();