1
+ import logger from "./shared/app-logger" ;
2
+ import { runCopilotAssociationsReport } from "./report/copilot-associations-report" ;
1
3
2
- // import { getMessage } from './index'
4
+ // Mock the logger and report function
5
+ jest . mock ( "./shared/app-logger" ) ;
6
+ jest . mock ( "./report/copilot-associations-report" ) ;
3
7
4
- // describe('getMessage()' , () => {
5
- // it(' should return the correct message when called', () => {
6
- // expect(getMessage()).toBe('Hello world!')
7
- // })
8
+ describe ( "index.ts" , ( ) => {
9
+ it ( " should log start and end messages" , async ( ) => {
10
+ const mockLoggerInfo = logger . info as jest . Mock ;
11
+ const mockRunReport = runCopilotAssociationsReport as jest . Mock ;
8
12
9
- // it('should be super smart', () => {
10
- // expect(true).toBe(true)
11
- // })
12
- // });
13
+ // Mock the report function to resolve with a test file name
14
+ mockRunReport . mockResolvedValue ( "test-output-file.txt" ) ;
15
+
16
+ // Import the index file to trigger the code
17
+ await import ( "./index" ) ;
18
+
19
+ // Check that the start message was logged
20
+ expect ( mockLoggerInfo ) . toHaveBeenCalledWith ( "START - Running copilot associations report..." ) ;
21
+
22
+ // Check that the end message was logged with the correct file name
23
+ expect ( mockLoggerInfo ) . toHaveBeenCalledWith ( "END - Generated copilot associations report test-output-file.txt" ) ;
24
+ } ) ;
25
+ } ) ;
0 commit comments