Skip to content

Commit 2e4d2c4

Browse files
committed
test: Fix tests to expect mode
1 parent 8200e4b commit 2e4d2c4

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/transformer.test.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,25 @@ import Pulsar from "pulsar-client";
33
import * as expandedApc from "./quicktype/expandedApc";
44
import { passengerCount } from "./protobuf/passengerCount";
55
import {
6-
getUniqueVehicleIdFromMqttTopic,
6+
getVehicleModeAndUniqueVehicleIdFromMqttTopic,
77
initializeTransformer,
88
wrapDefined,
99
} from "./transformer";
1010

11-
describe("Get unique vehicle IDs", () => {
12-
test("Get a unique vehicle ID from a valid MQTT topic", () => {
11+
describe("Get modes and unique vehicle IDs", () => {
12+
test("Get the mode and the unique vehicle ID from a valid MQTT topic", () => {
1313
const mqttTopic = "/hfp/v2/journey/ongoing/apc/bus/0022/00758";
14-
const uniqueVehicleId = "0022/00758";
15-
expect(getUniqueVehicleIdFromMqttTopic(mqttTopic)).toBe(uniqueVehicleId);
14+
const modeAndUniqueVehicleId = "bus/0022/00758";
15+
expect(getVehicleModeAndUniqueVehicleIdFromMqttTopic(mqttTopic)).toBe(
16+
modeAndUniqueVehicleId,
17+
);
1618
});
1719

18-
test("Get undefined instead of a unique vehicle ID from an invalid MQTT topic", () => {
20+
test("Get undefined instead of the mode and the unique vehicle ID from an invalid MQTT topic", () => {
1921
const mqttTopic = "/hfp/v2/journey/ongoing/foobar/0022/00758";
20-
expect(getUniqueVehicleIdFromMqttTopic(mqttTopic)).toBeUndefined();
22+
expect(
23+
getVehicleModeAndUniqueVehicleIdFromMqttTopic(mqttTopic),
24+
).toBeUndefined();
2125
});
2226
});
2327

@@ -150,7 +154,7 @@ describe("Transformer", () => {
150154
},
151155
},
152156
properties: {
153-
"mqtt-topic": "0018/00817",
157+
"mqtt-topic": "bus/0018/00817",
154158
},
155159
eventTimestamp: 1660731500000,
156160
});
@@ -236,7 +240,7 @@ describe("Transformer", () => {
236240
},
237241
},
238242
properties: {
239-
"mqtt-topic": "0018/01028",
243+
"mqtt-topic": "bus/0018/01028",
240244
},
241245
eventTimestamp: 1707664053746,
242246
});
@@ -314,7 +318,7 @@ describe("Transformer", () => {
314318
},
315319
},
316320
properties: {
317-
"mqtt-topic": "0018/01028",
321+
"mqtt-topic": "bus/0018/01028",
318322
},
319323
eventTimestamp: 1707664053746,
320324
});

0 commit comments

Comments
 (0)