@@ -45,6 +45,42 @@ describe("The 'hmset' method", function () {
45
45
} ) ;
46
46
} ) ;
47
47
48
+ it ( 'allows a numeric key without callback' , function ( done ) {
49
+ client . HMSET ( hash , 99 , 'banana' , 'test' , 25 ) ;
50
+ client . HGETALL ( hash , function ( err , obj ) {
51
+ assert . equal ( obj [ '99' ] , 'banana' ) ;
52
+ assert . equal ( obj [ 'test' ] , '25' ) ;
53
+ return done ( err ) ;
54
+ } ) ;
55
+ } ) ;
56
+
57
+ it ( 'allows an array without callback' , function ( done ) {
58
+ client . HMSET ( [ hash , 99 , 'banana' , 'test' , 25 ] ) ;
59
+ client . HGETALL ( hash , function ( err , obj ) {
60
+ assert . equal ( obj [ '99' ] , 'banana' ) ;
61
+ assert . equal ( obj [ 'test' ] , '25' ) ;
62
+ return done ( err ) ;
63
+ } ) ;
64
+ } ) ;
65
+
66
+ it ( 'allows an array and a callback' , function ( done ) {
67
+ client . HMSET ( [ hash , 99 , 'banana' , 'test' , 25 ] , helper . isString ( 'OK' ) ) ;
68
+ client . HGETALL ( hash , function ( err , obj ) {
69
+ assert . equal ( obj [ '99' ] , 'banana' ) ;
70
+ assert . equal ( obj [ 'test' ] , '25' ) ;
71
+ return done ( err ) ;
72
+ } ) ;
73
+ } ) ;
74
+
75
+ it ( 'handles object-style syntax without callback' , function ( done ) {
76
+ client . HMSET ( hash , { "0123456789" : "abcdefghij" , "some manner of key" : "a type of value" } ) ;
77
+ client . HGETALL ( hash , function ( err , obj ) {
78
+ assert . equal ( obj [ '0123456789' ] , 'abcdefghij' ) ;
79
+ assert . equal ( obj [ 'some manner of key' ] , 'a type of value' ) ;
80
+ return done ( err ) ;
81
+ } )
82
+ } ) ;
83
+
48
84
afterEach ( function ( ) {
49
85
client . end ( ) ;
50
86
} ) ;
0 commit comments