11import {
2+ afterAll ,
23 afterEach ,
34 beforeEach ,
45 describe ,
@@ -22,6 +23,10 @@ import * as downloadXlsxModule from '../utils/download-devup-xlsx'
2223import * as getColorCollectionModule from '../utils/get-devup-color-collection'
2324import * as uploadXlsxModule from '../utils/upload-devup-xlsx'
2425
26+ afterAll ( ( ) => {
27+ mock . restore ( )
28+ } )
29+
2530describe ( 'devup commands' , ( ) => {
2631 const downloadFileMock = mock ( ( ) => Promise . resolve ( undefined ) )
2732 const downloadXlsxMock = mock ( ( ) => Promise . resolve ( undefined ) )
@@ -382,7 +387,7 @@ describe('devup commands', () => {
382387 textSegmentToTypographySpy = spyOn (
383388 textSegmentToTypographyModule ,
384389 'textSegmentToTypography' ,
385- ) . mockReturnValue ( null )
390+ ) . mockReturnValue ( null as unknown as DevupTypography )
386391
387392 ; ( globalThis as { figma ?: unknown } ) . figma = {
388393 util : { rgba : ( v : unknown ) => v } ,
@@ -609,7 +614,8 @@ describe('devup commands', () => {
609614 name : '' ,
610615 } ) as unknown as TextStyle ,
611616 )
612- const loadFontAsync = mock ( ( ) => Promise . reject ( new Error ( 'font' ) ) )
617+ const loadFontAsync = mock ( ( ) => Promise . reject ( 'font' ) )
618+ spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
613619
614620 ; ( globalThis as { figma ?: unknown } ) . figma = {
615621 util : { rgba : ( v : unknown ) => v } ,
@@ -639,6 +645,10 @@ describe('devup commands', () => {
639645 expect . stringContaining ( 'Failed to create text style' ) ,
640646 expect . any ( Object ) ,
641647 )
648+ expect ( console . error ) . toHaveBeenCalledWith (
649+ 'Failed to create text style' ,
650+ 'font' ,
651+ )
642652 } )
643653
644654 test ( 'importDevup sets typography spacing values' , async ( ) => {
0 commit comments