@@ -310,6 +310,22 @@ module.exports = function(server, createClient, port) {
310
310
client . publish ( 'a' , 'b' , opts , done ) ;
311
311
} ) ;
312
312
} ) ;
313
+
314
+ it ( 'should support UTF-8 characters in topic' , function ( done ) {
315
+ var client = createClient ( port ) ;
316
+
317
+ client . once ( 'connect' , function ( ) {
318
+ client . publish ( '中国' , 'hello' , done ) ;
319
+ } ) ;
320
+ } )
321
+
322
+ it ( 'should support UTF-8 characters in payload' , function ( done ) {
323
+ var client = createClient ( port ) ;
324
+
325
+ client . once ( 'connect' , function ( ) {
326
+ client . publish ( 'hello' , '中国' , done ) ;
327
+ } ) ;
328
+ } )
313
329
} ) ;
314
330
315
331
describe ( 'unsubscribing' , function ( ) {
@@ -374,6 +390,22 @@ module.exports = function(server, createClient, port) {
374
390
} ) ;
375
391
} ) ;
376
392
} ) ;
393
+
394
+ it ( 'should unsubscribe from a chinese topic' , function ( done ) {
395
+ var client = createClient ( port ) ;
396
+ var topic = '中国' ;
397
+
398
+ client . once ( 'connect' , function ( ) {
399
+ client . unsubscribe ( topic ) ;
400
+ } ) ;
401
+
402
+ server . once ( 'client' , function ( client ) {
403
+ client . once ( 'unsubscribe' , function ( packet ) {
404
+ packet . unsubscriptions . should . containEql ( topic ) ;
405
+ done ( ) ;
406
+ } ) ;
407
+ } ) ;
408
+ } ) ;
377
409
} ) ;
378
410
379
411
describe ( 'pinging' , function ( ) {
@@ -427,6 +459,7 @@ module.exports = function(server, createClient, port) {
427
459
} ) ;
428
460
} ) ;
429
461
} ) ;
462
+
430
463
it ( 'should send a subscribe message' , function ( done ) {
431
464
var client = createClient ( port ) ;
432
465
@@ -506,6 +539,26 @@ module.exports = function(server, createClient, port) {
506
539
} ) ;
507
540
} ) ;
508
541
} ) ;
542
+
543
+ it ( 'should subscribe with a chinese topic' , function ( done ) {
544
+ var client = createClient ( port ) ;
545
+
546
+ var topic = '中国' ;
547
+
548
+ client . once ( 'connect' , function ( ) {
549
+ client . subscribe ( topic ) ;
550
+ } ) ;
551
+
552
+ server . once ( 'client' , function ( client ) {
553
+ client . once ( 'subscribe' , function ( packet ) {
554
+ packet . subscriptions . should . containEql ( {
555
+ topic : topic ,
556
+ qos : 0
557
+ } ) ;
558
+ done ( ) ;
559
+ } ) ;
560
+ } ) ;
561
+ } ) ;
509
562
} ) ;
510
563
511
564
describe ( 'receiving messages' , function ( ) {
0 commit comments