@@ -369,6 +369,40 @@ export const testBinaryCodegen = (transcode: (system: TypeSystem, type: Type, va
369369 } ) ;
370370 } ) ;
371371
372+ describe ( '"map" type' , ( ) => {
373+ test ( 'can encode empty map' , ( ) => {
374+ const system = new TypeSystem ( ) ;
375+ const t = system . t ;
376+ const type = t . map ;
377+ const value : { } = { } ;
378+ expect ( transcode ( system , type , value ) ) . toStrictEqual ( value ) ;
379+ } ) ;
380+
381+ test ( 'can encode empty map with one key' , ( ) => {
382+ const system = new TypeSystem ( ) ;
383+ const t = system . t ;
384+ const type = t . map ;
385+ const value : { } = { a : 'asdf' } ;
386+ expect ( transcode ( system , type , value ) ) . toStrictEqual ( value ) ;
387+ } ) ;
388+
389+ test ( 'can encode typed map with two keys' , ( ) => {
390+ const system = new TypeSystem ( ) ;
391+ const t = system . t ;
392+ const type = t . Map ( t . bool ) ;
393+ const value : { } = { x : true , y : false } ;
394+ expect ( transcode ( system , type , value ) ) . toStrictEqual ( value ) ;
395+ } ) ;
396+
397+ test ( 'can encode nested maps' , ( ) => {
398+ const system = new TypeSystem ( ) ;
399+ const t = system . t ;
400+ const type = t . Map ( t . Map ( t . bool ) ) ;
401+ const value : { } = { a : { x : true , y : false } } ;
402+ expect ( transcode ( system , type , value ) ) . toStrictEqual ( value ) ;
403+ } ) ;
404+ } ) ;
405+
372406 describe ( '"ref" type' , ( ) => {
373407 test ( 'can encode a simple reference' , ( ) => {
374408 const system = new TypeSystem ( ) ;
0 commit comments