diff --git a/packages/mqtt/package.json b/packages/mqtt/package.json index 2a01898b..ed35d354 100644 --- a/packages/mqtt/package.json +++ b/packages/mqtt/package.json @@ -1,6 +1,6 @@ { "name": "@walmartlabs/cookie-cutter-mqtt", - "version": "1.6.0-beta.0", + "version": "1.6.0-beta.1", "license": "Apache-2.0", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -27,4 +27,4 @@ "lint": "tslint --project tsconfig.json", "lint:fix": "yarn run lint --fix" } -} +} \ No newline at end of file diff --git a/packages/mqtt/src/MqttSink.ts b/packages/mqtt/src/MqttSink.ts index d9ea2a38..eacd2185 100644 --- a/packages/mqtt/src/MqttSink.ts +++ b/packages/mqtt/src/MqttSink.ts @@ -105,6 +105,8 @@ export class MqttPublisherSink MqttMetricResults.error ); failSpan(span, error); + + throw error; } else { this.emitMetrics( topic, diff --git a/packages/mqtt/src/__test__/MqttSink.test.ts b/packages/mqtt/src/__test__/MqttSink.test.ts index cd1937d3..e06063df 100644 --- a/packages/mqtt/src/__test__/MqttSink.test.ts +++ b/packages/mqtt/src/__test__/MqttSink.test.ts @@ -35,6 +35,7 @@ jest.mock("mqtt", () => { publish: mockMqttPublisher, removeAllListeners: jest.fn(), end: jest.fn(), + connected: true, }; }), }; @@ -150,8 +151,7 @@ describe.each([ mockMessageHandlerWithoutTopicMetadata ); - await testApp; - expect(mockMqttPublisher).toBeCalledTimes(testMessages.length); + await expect(testApp).rejects.toThrow(); }); it("Verifies if CONNECT handler WITHOUT ERROR generated works as expected", async () => { @@ -290,8 +290,7 @@ describe.each([ mockMessageHandlerWithTopicMetadata ); - await testApp; - expect(mockMqttPublisher).toBeCalledTimes(testMessages.length); + await expect(testApp).rejects.toThrow(); }); it("Verifies if CONNECT handler WITHOUT ERROR generated works as expected", async () => {