@@ -103,7 +103,7 @@ tape.test("converters", function(test) {
103
103
bytesVal : buf ,
104
104
bytesRepeated : [ buf , buf ] ,
105
105
enumVal : 2 ,
106
- enumRepeated : [ 1 , 2 ] ,
106
+ enumRepeated : [ 1 , 100 , 2 ] ,
107
107
int64Map : {
108
108
a : protobuf . util . Long . fromNumber ( 2 ) ,
109
109
b : protobuf . util . Long . fromNumber ( 3 )
@@ -127,6 +127,7 @@ tape.test("converters", function(test) {
127
127
test . ok ( Buffer . isBuffer ( Message . toObject ( msg , { bytes : Buffer } ) . bytesVal ) , "bytes to buffers" ) ;
128
128
129
129
test . equal ( Message . toObject ( msg , { enums : String } ) . enumVal , "TWO" , "enums to strings" ) ;
130
+ test . equal ( Message . toObject ( msg , { enums : String } ) . enumRepeated [ 1 ] , 100 , "enums to strings does not change unknown values" ) ;
130
131
131
132
test . end ( ) ;
132
133
} ) ;
@@ -157,7 +158,7 @@ tape.test("converters", function(test) {
157
158
bytesVal : "MTEx" ,
158
159
bytesRepeated : [ "MTEx" , [ 49 , 49 , 49 ] ] ,
159
160
enumVal : "ONE" ,
160
- enumRepeated : [ 2 , "TWO" ] ,
161
+ enumRepeated : [ 2 , "TWO" , 100 ] ,
161
162
int64Map : {
162
163
a : 2 ,
163
164
b : "3"
@@ -176,7 +177,7 @@ tape.test("converters", function(test) {
176
177
test . same ( msg . bytesVal , buf , "should set bytesVal from a base64 string" ) ;
177
178
test . same ( msg . bytesRepeated , [ buf , buf ] , "should set bytesRepeated from a base64 string and a plain array" ) ;
178
179
test . equal ( msg . enumVal , 1 , "should set enumVal from a string" ) ;
179
- test . same ( msg . enumRepeated , [ 2 , 2 ] , "should set enumRepeated from a number and a string" ) ;
180
+ test . same ( msg . enumRepeated , [ 2 , 2 , 100 ] , "should set enumRepeated from a number and a string and preserve unknown value " ) ;
180
181
test . same ( msg . int64Map , { a : { low : 2 , high : 0 , unsigned : false } , b : { low : 3 , high : 0 , unsigned : false } } , "should set int64Map from a number and a string" ) ;
181
182
182
183
test . end ( ) ;
0 commit comments