Now when a "publish" command fails, then the publish method will throw an error (#229)

Errors in the hook when doing a publish were ignored. This caused that test cases could not be made where the publish failed and an error was thrown.

Co-authored-by: hector.oliveros@wabtec.com <hectoroliveros@MacBook-Pro-de-Hector.local>
This commit is contained in:
Hector Oliveros
2023-05-18 15:14:50 -04:00
committed by GitHub
parent 565e07747e
commit 7ad6dd8e1a
2 changed files with 7 additions and 6 deletions

View File

@@ -338,7 +338,7 @@ func TestHooksOnPublish(t *testing.T) {
// coverage: failure
hook.fail = true
pk, err = h.OnPublish(new(Client), packets.Packet{PacketID: 10})
require.NoError(t, err)
require.Error(t, err)
require.Equal(t, uint16(10), pk.PacketID)
// coverage: reject packet