tabletcommand-incident 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,31 @@
1
+ import chai from "chai";
2
+ import "mocha";
3
+
4
+ const assert = chai.assert;
5
+
6
+ import _ from "lodash";
7
+ import { CADIncident } from "tabletcommand-backend-models";
8
+
9
+ import setIncidentType from "../set-incident-type";
10
+
11
+ const testMatchCombineCrossStreet: Partial<CADIncident> = {
12
+ departmentId: "515",
13
+ IncidentNumber: "i1238",
14
+ CrossStreet1: "Cedar Rd",
15
+ CrossStreet2: "Thunder Dr",
16
+ LocationComment: "1700 Bart Dr"
17
+ };
18
+
19
+ describe("incident type", function() {
20
+ it("should set incident type any", function() {
21
+ const testMatchIncident = _.clone(testMatchCombineCrossStreet);
22
+ setIncidentType.setIncidentType(testMatchIncident, []);
23
+
24
+ assert.ok(_.has(testMatchIncident, "notificationType"), "Should have notificationType");
25
+ assert.strictEqual(_.size(testMatchIncident.notificationType), 1);
26
+
27
+ const a = testMatchIncident.notificationType?.[0];
28
+ assert.strictEqual(a?.name, "Any");
29
+ assert.strictEqual(a?.value, "any");
30
+ });
31
+ });
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "declaration": true,
5
+ "declarationDir": "../definitions",
6
+ "declarationMap": true,
7
+ "esModuleInterop": true,
8
+ "module": "commonjs",
9
+ "moduleResolution": "node",
10
+ "noImplicitAny": true,
11
+ "outDir": "../build",
12
+ "paths": {
13
+ "*": [
14
+ "../node_modules/@types/*",
15
+ "*"
16
+ ],
17
+ },
18
+ "resolveJsonModule": true,
19
+ "sourceMap": true,
20
+ "strict": true,
21
+ "target": "es2017",
22
+ "types": [
23
+ "node",
24
+ "mocha"
25
+ ]
26
+ },
27
+ "exclude": [
28
+ //"test/**.ts"
29
+ ]
30
+ }
package/src/types.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { Location } from "tabletcommand-backend-models";
2
+
3
+ export interface LocationPayload {
4
+ latitude: number | string;
5
+ longitude: number | string;
6
+ vehicleId: string;
7
+ radioName: string;
8
+ avlTime: string;
9
+ speed?: number;
10
+ }
11
+
12
+ export interface Vehicle {
13
+ departmentId: string;
14
+ modifiedDate: number;
15
+ modified: Date;
16
+ radioName: string;
17
+ vehicleId: string;
18
+ }
19
+
20
+ export interface decodedLocation {
21
+ cadAVL: Partial<Location>,
22
+ isValid: boolean
23
+ }
24
+
25
+ export interface LocationDelta {
26
+ active?: boolean;
27
+ agencyCode?: string;
28
+ agencyName?: string;
29
+ device_type?: string;
30
+ opAreaCode?: string;
31
+ opAreaName?: string;
32
+ shared?: boolean;
33
+ state?: string;
34
+ username?: string;
35
+ }
36
+
37
+ export type LocationObject = {
38
+ [P in keyof Location]: Location[P]
39
+ }
package/test.sh ADDED
@@ -0,0 +1,32 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+
5
+ if [ -f ~/.bash_profile ]; then
6
+ source ~/.bash_profile
7
+ fi
8
+
9
+ if [ -f ~/.profile ]; then
10
+ source ~/.profile
11
+ fi
12
+
13
+ # MacOS
14
+ if hash brew 2>/dev/null; then
15
+ if [ -f $(brew --prefix nvm)/nvm.sh ]; then
16
+ source $(brew --prefix nvm)/nvm.sh
17
+ fi
18
+ fi
19
+
20
+ NODE_VERSION="v16.19.0"
21
+
22
+ nvm use $NODE_VERSION || nvm install $NODE_VERSION
23
+
24
+ npm install
25
+ echo "--- spelling"
26
+ npx cspell
27
+ echo "--- type coverage"
28
+ npx type-coverage
29
+ echo "--- lint"
30
+ npm run lint
31
+ echo "--- test"
32
+ npm test