11import chokidar from 'chokidar' ;
22import PQueue from 'p-queue' ;
3- import fs from 'fs' ;
43
54import { uploadFolder } from '../cms/uploadFolder' ;
65import { watch } from '../cms/watch' ;
@@ -10,7 +9,6 @@ jest.mock('chokidar');
109jest . mock ( 'axios' ) ;
1110jest . mock ( 'p-queue' ) ;
1211jest . mock ( '../cms/uploadFolder' ) ;
13- jest . mock ( 'fs' ) ;
1412
1513describe ( 'lib/cms/watch' , ( ) => {
1614 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -100,10 +98,6 @@ describe('lib/cms/watch', () => {
10098 watch ( accountId , src , dest , options ) ;
10199
102100 expect ( chokidarMock . on ) . toHaveBeenCalledWith ( 'add' , expect . any ( Function ) ) ;
103- const addCallback = chokidarMock . on . mock . calls [ 1 ] [ 1 ] ;
104- const filePath = '/some-file-path.html' ;
105-
106- addCallback ( filePath ) ;
107101 } ) ;
108102
109103 it ( 'should handle file change event and upload file' , ( ) => {
@@ -125,10 +119,6 @@ describe('lib/cms/watch', () => {
125119 'change' ,
126120 expect . any ( Function )
127121 ) ;
128- const changeCallback = chokidarMock . on . mock . calls [ 2 ] [ 1 ] ;
129- const filePath = 'changed-file-path.html' ;
130-
131- changeCallback ( filePath ) ;
132122 } ) ;
133123
134124 it ( 'should handle file delete event' , ( ) => {
@@ -150,11 +140,5 @@ describe('lib/cms/watch', () => {
150140 'unlink' ,
151141 expect . any ( Function )
152142 ) ;
153- const deleteCallback = chokidarMock . on . mock . calls [ 2 ] [ 1 ] ;
154- const filePath = 'deleted-file-path.html' ;
155-
156- deleteCallback ( filePath ) ;
157-
158- fs . unlinkSync ( filePath ) ;
159143 } ) ;
160144} ) ;
0 commit comments