Skip to content

Commit

Permalink
Added test for empty topic
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Jul 20, 2017
1 parent 0606069 commit 7abd055
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/basic.js
Expand Up @@ -487,6 +487,28 @@ test('avoid wrong deduping of retain messages', function (t) {
publisher.inStream.write(expected)
})

test('publish empty topic', function (t) {
var s = connect(setup())

subscribe(t, s, '#', 0, function () {
s.outStream.once('data', function (packet) {
t.fail('no packet')
t.end()
})

s.inStream.write({
cmd: 'publish',
topic: '',
payload: 'world'
})
})

eos(s.conn, function () {
t.equal(s.broker.connectedClients, 0, 'no connected clients')
t.end()
})
})

test('publish invalid topic with #', function (t) {
var s = connect(setup())

Expand Down

0 comments on commit 7abd055

Please sign in to comment.