mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
test: mock Unix platform for SIGTERM behavior in ClaudeUsageService tests
Added a mock for the Unix platform in the SIGTERM test case to ensure proper behavior during testing on non-Windows systems. This change enhances the reliability of the tests by simulating the expected environment for process termination.
This commit is contained in:
@@ -681,7 +681,9 @@ Resets in 2h
|
|||||||
|
|
||||||
it('should send SIGTERM after ESC if process does not exit', async () => {
|
it('should send SIGTERM after ESC if process does not exit', async () => {
|
||||||
vi.useFakeTimers();
|
vi.useFakeTimers();
|
||||||
const windowsService = new ClaudeUsageService();
|
// Mock Unix platform to test SIGTERM behavior (Windows calls kill() without signal)
|
||||||
|
vi.mocked(os.platform).mockReturnValue('darwin');
|
||||||
|
const ptyService = new ClaudeUsageService();
|
||||||
|
|
||||||
let dataCallback: Function | undefined;
|
let dataCallback: Function | undefined;
|
||||||
|
|
||||||
@@ -696,7 +698,7 @@ Resets in 2h
|
|||||||
};
|
};
|
||||||
vi.mocked(pty.spawn).mockReturnValue(mockPty as any);
|
vi.mocked(pty.spawn).mockReturnValue(mockPty as any);
|
||||||
|
|
||||||
windowsService.fetchUsageData();
|
ptyService.fetchUsageData();
|
||||||
|
|
||||||
// Simulate seeing usage data
|
// Simulate seeing usage data
|
||||||
dataCallback!('Current session\n65% left');
|
dataCallback!('Current session\n65% left');
|
||||||
|
|||||||
Reference in New Issue
Block a user