@@ -17,13 +17,26 @@ jest.mock('child_process', () => ({
1717
1818import { buildReactUI } from '../src/commands/build' ;
1919
20- const createSpinner = ( ) => ( {
21- text : '' ,
22- start : jest . fn ( ) . mockReturnThis ( ) ,
23- succeed : jest . fn ( ) . mockReturnThis ( ) ,
24- fail : jest . fn ( ) . mockReturnThis ( ) ,
25- warn : jest . fn ( ) . mockReturnThis ( ) ,
26- } ) ;
20+ import type { Ora } from 'ora' ;
21+
22+ const createSpinner = ( ) : Ora =>
23+ ( {
24+ text : '' ,
25+ isSpinning : false ,
26+ color : 'cyan' ,
27+ prefixText : '' ,
28+ indent : 0 ,
29+ start : jest . fn ( ) . mockReturnThis ( ) ,
30+ succeed : jest . fn ( ) . mockReturnThis ( ) ,
31+ fail : jest . fn ( ) . mockReturnThis ( ) ,
32+ warn : jest . fn ( ) . mockReturnThis ( ) ,
33+ info : jest . fn ( ) . mockReturnThis ( ) ,
34+ stop : jest . fn ( ) . mockReturnThis ( ) ,
35+ stopAndPersist : jest . fn ( ) . mockReturnThis ( ) ,
36+ clear : jest . fn ( ) . mockReturnThis ( ) ,
37+ render : jest . fn ( ) . mockReturnThis ( ) ,
38+ frame : jest . fn ( ) . mockReturnValue ( '' ) ,
39+ } ) as unknown as Ora ;
2740
2841describe ( 'buildReactUI' , ( ) => {
2942 it ( 'writes docs.json and config.json into the output directory' , async ( ) => {
@@ -54,7 +67,7 @@ describe('buildReactUI', () => {
5467 await fs . writeFile ( faviconPath , '<svg></svg>' , 'utf-8' ) ;
5568
5669 const outputDir = path . join ( tempDir , 'out' ) ;
57- const spinner = createSpinner ( ) as unknown as ReturnType < typeof import ( 'ora' ) > ;
70+ const spinner = createSpinner ( ) ;
5871
5972 const configDir = path . join ( tempDir , 'config' ) ;
6073 const docsDir = path . join ( configDir , 'docs' ) ;
@@ -66,7 +79,7 @@ describe('buildReactUI', () => {
6679 uiDir,
6780 configDir,
6881 uiConfig : {
69- theme : { primaryColor : '#123456' , logo : logoPath , favicon : faviconPath } ,
82+ theme : { name : 'Test' , primaryColor : '#123456' , logo : logoPath , favicon : faviconPath } ,
7083 features : { search : false } ,
7184 sidebar : [ { title : 'Guide' , path : '/docs/intro.md' } ] ,
7285 } ,
0 commit comments