aedes icon indicating copy to clipboard operation
aedes copied to clipboard

[question] does the test "unsubscribe throws error" valid?

Open gnought opened this issue 1 year ago • 3 comments

https://github.com/moscajs/aedes/blob/bba422b7733d9946566647c7300c1b293e8cd8cf/test/client-pub-sub.js#L664-L688

The mocked broker.unsubscribe is only called by broker.close.

  1. Does it expect to be called by client.subscribe ?
  2. The Error does not be raised in client error event. Bug?
  3. The callback in client.subscribe does not contain any error argument, does the message in t.pass make sense?

gnought avatar Feb 16 '24 06:02 gnought

By reading it makes no sense to me too. I think it should be something like:

client.unsubscribe({ 
         topic: 'hello', 
         qos: 0 
       }, function (err) { 
         t.equal(err.message, 'error', 'throws error') 
       }) 

robertsLando avatar Feb 16 '24 08:02 robertsLando

@robertsLando so do I, however the callback call doesn't have err parameter.

gnought avatar Feb 16 '24 11:02 gnought

I should try it so, I dunno sincerly... let me know if you fix it

robertsLando avatar Feb 16 '24 13:02 robertsLando