@@ -370,6 +370,56 @@ describe('devup commands', () => {
370370 expect ( Array . isArray ( parsed . theme ?. typography ?. heading ) ) . toBe ( true )
371371 } )
372372
373+ test ( 'exportDevup filters out empty typography entries' , async ( ) => {
374+ getColorCollectionSpy = spyOn (
375+ getColorCollectionModule ,
376+ 'getDevupColorCollection' ,
377+ ) . mockResolvedValue ( null )
378+ styleNameToTypographySpy = spyOn (
379+ styleNameToTypographyModule ,
380+ 'styleNameToTypography' ,
381+ ) . mockReturnValue ( { level : 0 , name : 'heading' } )
382+ textSegmentToTypographySpy = spyOn (
383+ textSegmentToTypographyModule ,
384+ 'textSegmentToTypography' ,
385+ ) . mockReturnValue ( null )
386+
387+ ; ( globalThis as { figma ?: unknown } ) . figma = {
388+ util : { rgba : ( v : unknown ) => v } ,
389+ variables : { } ,
390+ loadAllPagesAsync : async ( ) => { } ,
391+ getLocalTextStylesAsync : async ( ) => [
392+ {
393+ id : 'id' ,
394+ name : 'heading/1' ,
395+ fontName : { family : 'Inter' , style : 'Regular' } ,
396+ } as unknown as TextStyle ,
397+ ] ,
398+ root : {
399+ findAllWithCriteria : ( ) => [
400+ {
401+ textStyleId : 'id' ,
402+ getStyledTextSegments : ( ) => [ { textStyleId : 'id' } ] ,
403+ } as unknown as TextNode ,
404+ ] ,
405+ } ,
406+ getStyleByIdAsync : async ( ) =>
407+ ( {
408+ id : 'id' ,
409+ name : 'heading/1' ,
410+ fontName : { family : 'Inter' , style : 'Regular' } ,
411+ } ) as unknown as TextStyle ,
412+ } as unknown as typeof figma
413+
414+ await exportDevup ( 'json' )
415+
416+ const payload = JSON . parse (
417+ ( downloadFileMock . mock . calls [ 0 ] as unknown as { args : [ string , string ] } )
418+ ?. args ?. [ 1 ] ?? '{}' ,
419+ )
420+ expect ( payload . theme ?. typography ) . toBeUndefined ( )
421+ } )
422+
373423 test ( 'importDevup creates colors and typography from json' , async ( ) => {
374424 getColorCollectionSpy = spyOn (
375425 getColorCollectionModule ,
0 commit comments