@@ -103,7 +103,7 @@ tape.test("converters", function(test) {
103103 bytesVal : buf ,
104104 bytesRepeated : [ buf , buf ] ,
105105 enumVal : 2 ,
106- enumRepeated : [ 1 , 2 ] ,
106+ enumRepeated : [ 1 , 100 , 2 ] ,
107107 int64Map : {
108108 a : protobuf . util . Long . fromNumber ( 2 ) ,
109109 b : protobuf . util . Long . fromNumber ( 3 )
@@ -127,6 +127,7 @@ tape.test("converters", function(test) {
127127 test . ok ( Buffer . isBuffer ( Message . toObject ( msg , { bytes : Buffer } ) . bytesVal ) , "bytes to buffers" ) ;
128128
129129 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" ) ;
130131
131132 test . end ( ) ;
132133 } ) ;
@@ -157,7 +158,7 @@ tape.test("converters", function(test) {
157158 bytesVal : "MTEx" ,
158159 bytesRepeated : [ "MTEx" , [ 49 , 49 , 49 ] ] ,
159160 enumVal : "ONE" ,
160- enumRepeated : [ 2 , "TWO" ] ,
161+ enumRepeated : [ 2 , "TWO" , 100 ] ,
161162 int64Map : {
162163 a : 2 ,
163164 b : "3"
@@ -176,7 +177,7 @@ tape.test("converters", function(test) {
176177 test . same ( msg . bytesVal , buf , "should set bytesVal from a base64 string" ) ;
177178 test . same ( msg . bytesRepeated , [ buf , buf ] , "should set bytesRepeated from a base64 string and a plain array" ) ;
178179 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 " ) ;
180181 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" ) ;
181182
182183 test . end ( ) ;
0 commit comments