|
1 | 1 | import { jest } from '@jest/globals'; |
| 2 | +import { normalize } from 'path'; |
2 | 3 |
|
3 | 4 | const writeFileSyncMock = jest.fn(); |
4 | 5 | const renameFileSyncMock = jest.fn(); |
@@ -101,22 +102,22 @@ describe('LoggerService', () => { |
101 | 102 |
|
102 | 103 | describe('getSuggestLogfilePath', () => { |
103 | 104 | it('the path should includes the os tmp dir', () => { |
104 | | - const path = logger.getSuggestLogfilePath(); |
105 | | - expect(path.includes('/tmpDir')).toBeTruthy(); |
| 105 | + const path = logger.getSuggestLogFilePath(); |
| 106 | + expect(path.includes(normalize('/tmpDir'))).toBeTruthy(); |
106 | 107 | }); |
107 | 108 | }); |
108 | 109 |
|
109 | 110 | describe('LogFile rotation', () => { |
110 | 111 | it('should not rotate file if not exist', () => { |
111 | 112 | existsSyncMock.mockReturnValue(false); |
112 | | - const path = logger.getSuggestLogfilePath(); |
| 113 | + const path = logger.getSuggestLogFilePath(); |
113 | 114 | logger.saveToFile(path); |
114 | 115 | expect(renameFileSyncMock).not.toBeCalled(); |
115 | 116 | }); |
116 | 117 |
|
117 | 118 | it('should rotate file if exist', () => { |
118 | 119 | existsSyncMock.mockReturnValue(true); |
119 | | - const path = logger.getSuggestLogfilePath(); |
| 120 | + const path = logger.getSuggestLogFilePath(); |
120 | 121 | logger.saveToFile(path); |
121 | 122 | const expectedOldPath = path.replace('latest', 'old'); |
122 | 123 | expect(renameFileSyncMock).toBeCalledWith(path, expectedOldPath); |
|
0 commit comments