File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -261,6 +261,43 @@ describe('codec', function() {
261261 } ) ;
262262 } ) ;
263263
264+ it ( 'should skip falsy struct keys in JSON' , function ( ) {
265+ var value = {
266+ undefined : '1'
267+ } ;
268+
269+ var int = { int : true } ;
270+ codec . Int = function ( value_ ) {
271+ assert . strictEqual ( value_ , value [ undefined ] ) ;
272+ return int ;
273+ } ;
274+
275+ var decoded = codec . decode ( value , {
276+ type : {
277+ code : 'STRUCT' ,
278+ structType : {
279+ fields : [
280+ {
281+ name : undefined ,
282+ type : {
283+ code : 'INT64'
284+ }
285+ }
286+ ]
287+ }
288+ }
289+ } ) ;
290+
291+ assert . deepEqual ( decoded , [
292+ {
293+ name : undefined ,
294+ value : int
295+ }
296+ ] ) ;
297+
298+ assert . deepEqual ( decoded . toJSON ( ) , { } ) ;
299+ } ) ;
300+
264301 it ( 'should decode STRUCT and inner members by index' , function ( ) {
265302 var value = [
266303 '1'
You can’t perform that action at this time.
0 commit comments