Skip to content

Commit

Permalink
fix: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed May 24, 2024
1 parent bbc3187 commit e6da804
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/mqtt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ describe('mqtt', () => {
c.should.be.instanceOf(mqtt.MqttClient)
c.options.should.have.property('username', 'user')
c.options.should.have.property('password', 'pass')
c.options.should.not.have.property('path')
c.end((err) => done(err))
})

it('should return an MqttClient with path set when protocol is ws/wss', function _test(t, done) {
const c = mqtt.connect('ws://localhost:1883/mqtt')

c.should.be.instanceOf(mqtt.MqttClient)
c.options.should.have.property('path', '/mqtt')
c.end((err) => done(err))
})

Expand All @@ -47,6 +56,7 @@ describe('mqtt', () => {
const c = mqtt.connect('mqtt://user@localhost:1883')

c.should.be.instanceOf(mqtt.MqttClient)
c.options.should.not.have.property('path')
c.options.should.have.property('username', 'user')
c.end((err) => done(err))
})
Expand Down

0 comments on commit e6da804

Please sign in to comment.