Skip to content

Commit

Permalink
update snapshot tests - bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaushik-rishi committed May 4, 2024
1 parent 0d953a8 commit 2f60498
Showing 1 changed file with 22 additions and 54 deletions.
76 changes: 22 additions & 54 deletions test/__snapshots__/integration.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,13 @@ const router = new Router();
const lightTurnOffHandler = require('../handlers/lightTurnOff');
module.exports = router;
router.use('smartylighting.streetlights.1.0.action.:streetlightId.turn.off', async (message, next) => {
router.useOutbound('smartylighting.streetlights.1.0.action.:streetlightId.turn.off', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.off', 'turnOnOff', 'subscribe');
await lightTurnOffHandler._turnOff({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -196,12 +194,10 @@ module.exports = router;
router.use('smartylighting.streetlights.1.0.event.:streetlightId.lighting.measured', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured', 'lightMeasured', 'publish');
await lightingMeasuredHandler._receiveLightMeasurement({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -217,15 +213,13 @@ const router = new Router();
const lightTurnOnHandler = require('../handlers/lightTurnOn');
module.exports = router;
router.use('smartylighting.streetlights.1.0.action.:streetlightId.turn.on', async (message, next) => {
router.useOutbound('smartylighting.streetlights.1.0.action.:streetlightId.turn.on', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting.streetlights.1.0.action.{streetlightId}.turn.on', 'turnOnOff', 'subscribe');
await lightTurnOnHandler._turnOn({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -241,15 +235,13 @@ const router = new Router();
const lightsDimHandler = require('../handlers/lightsDim');
module.exports = router;
router.use('smartylighting.streetlights.1.0.action.:streetlightId.dim', async (message, next) => {
router.useOutbound('smartylighting.streetlights.1.0.action.:streetlightId.dim', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting.streetlights.1.0.action.{streetlightId}.dim', 'dimLight', 'subscribe');
await lightsDimHandler._dimLight({
message
});
next();
} catch (e) {
next(e);
}
Expand Down Expand Up @@ -287,13 +279,13 @@ app.use(logger);
// Channels
console.log(cyan.bold.inverse(' SUB '), gray('Subscribed to'), yellow('lightingMeasured'));
console.log(cyan.bold.inverse(' SUB '), gray('Subscribed to'), yellow('smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured'));
app.use(lightingMeasured);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightTurnOn'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting.streetlights.1.0.action.{streetlightId}.turn.on'));
app.useOutbound(lightTurnOn);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightTurnOff'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting.streetlights.1.0.action.{streetlightId}.turn.off'));
app.useOutbound(lightTurnOff);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightsDim'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting.streetlights.1.0.action.{streetlightId}.dim'));
app.useOutbound(lightsDim);
app.use(errorLogger);
Expand Down Expand Up @@ -348,7 +340,7 @@ exports[`template integration tests for generated files using the generator and
consumerOptions:
groupId: streetlightsKafkaApi
topics:
- lightingMeasured
- smartylighting.streetlights.1.0.event.{streetlightId}.lighting.measured
topicSeparator: '__'
topicPrefix:
Expand Down Expand Up @@ -551,15 +543,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdDimHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-dim');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/dim', 'dimLight', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdDimHandler._dimLight({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -575,15 +565,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdTurnOffHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-turn-off');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off', 'turnOnOff', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdTurnOffHandler._turnOff({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -599,15 +587,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdTurnOnHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-turn-on');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on', 'turnOnOff', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdTurnOnHandler._turnOn({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -629,13 +615,11 @@ module.exports = router;
router.use('smartylighting/streetlights/1/0/event/:streetlightId/lighting/measured', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured', 'lightMeasured', 'publish');
await smartylightingStreetlights10EventStreetlightIdLightingMeasuredHandler._receiveLightMeasurement({
message
});
next();
} catch (e) {
next(e);
}
Expand Down Expand Up @@ -930,15 +914,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdDimHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-dim');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/dim', 'dimLight', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdDimHandler._dimLight({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -954,15 +936,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdTurnOffHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-turn-off');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off', 'turnOnOff', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdTurnOffHandler._turnOff({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -978,15 +958,13 @@ const router = new Router();
const smartylightingStreetlights10ActionStreetlightIdTurnOnHandler = require('../handlers/smartylighting-streetlights-1-0-action-{streetlightId}-turn-on');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on', 'turnOnOff', 'subscribe');
await smartylightingStreetlights10ActionStreetlightIdTurnOnHandler._turnOn({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -1008,13 +986,11 @@ module.exports = router;
router.use('smartylighting/streetlights/1/0/event/:streetlightId/lighting/measured', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured', 'lightMeasured', 'publish');
await smartylightingStreetlights10EventStreetlightIdLightingMeasuredHandler._receiveLightMeasurement({
message
});
next();
} catch (e) {
next(e);
}
Expand Down Expand Up @@ -1309,15 +1285,13 @@ const router = new Router();
const lightTurnOffHandler = require('../handlers/lightTurnOff');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/off', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/off', 'turnOnOff', 'subscribe');
await lightTurnOffHandler._turnOff({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -1340,12 +1314,10 @@ module.exports = router;
router.use('smartylighting/streetlights/1/0/event/:streetlightId/lighting/measured', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured', 'lightMeasured', 'publish');
await lightingMeasuredHandler._receiveLightMeasurement({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -1361,15 +1333,13 @@ const router = new Router();
const lightTurnOnHandler = require('../handlers/lightTurnOn');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/turn/on', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/turn/on', 'turnOnOff', 'subscribe');
await lightTurnOnHandler._turnOn({
message
});
next();
} catch (e) {
next(e);
}
Expand All @@ -1385,15 +1355,13 @@ const router = new Router();
const lightsDimHandler = require('../handlers/lightsDim');
module.exports = router;
router.use('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
router.useOutbound('smartylighting/streetlights/1/0/action/:streetlightId/dim', async (message, next) => {
try {
await validateMessage(message.payload, 'smartylighting/streetlights/1/0/action/{streetlightId}/dim', 'dimLight', 'subscribe');
await lightsDimHandler._dimLight({
message
});
next();
} catch (e) {
next(e);
}
Expand Down Expand Up @@ -1431,13 +1399,13 @@ app.use(logger);
// Channels
console.log(cyan.bold.inverse(' SUB '), gray('Subscribed to'), yellow('lightingMeasured'));
console.log(cyan.bold.inverse(' SUB '), gray('Subscribed to'), yellow('smartylighting/streetlights/1/0/event/{streetlightId}/lighting/measured'));
app.use(lightingMeasured);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightTurnOn'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting/streetlights/1/0/action/{streetlightId}/turn/on'));
app.useOutbound(lightTurnOn);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightTurnOff'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting/streetlights/1/0/action/{streetlightId}/turn/off'));
app.useOutbound(lightTurnOff);
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('lightsDim'));
console.log(yellow.bold.inverse(' PUB '), gray('Will eventually publish to'), yellow('smartylighting/streetlights/1/0/action/{streetlightId}/dim'));
app.useOutbound(lightsDim);
app.use(errorLogger);
Expand Down Expand Up @@ -1486,7 +1454,7 @@ exports[`template integration tests for generated files using the generator and
mqtt:
url: mqtt://test.mosquitto.org:1883/
topics: [\\"lightingMeasured\\"]
topics: [\\"smartylighting/streetlights/1/0/event/+/lighting/measured\\"]
qos:
protocol: mqtt
retain:
Expand Down

0 comments on commit 2f60498

Please sign in to comment.