mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-07-10 01:29:17 +00:00
fix(loop): update Session token-limit test for the disable() breaker
CI regression from the disable() refactor (7f488e6c6): the token-limit
breaker now calls scheduler.disable() instead of stop(), but the
cron-fired token-limit test still asserted scheduler.stop and its mock
scheduler had no disable() — so the call hit an undefined method and the
stop spy saw 0 calls. Missed because the prior change ran core tests +
cli tsc but not the cli test suite (Session.test.ts is cli).
Add disable() to the mock and assert it's called once. The breaker
disables (permanent for the session, so a later LoopWakeup is rejected),
which internally stops too.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
parent
37ee6fe362
commit
240e8892bc
1 changed files with 4 additions and 1 deletions
|
|
@ -3259,6 +3259,7 @@ describe('Session', () => {
|
|||
callback({ prompt: 'scheduled prompt' });
|
||||
}),
|
||||
stop: vi.fn(),
|
||||
disable: vi.fn(),
|
||||
getExitSummary: vi.fn().mockReturnValue(undefined),
|
||||
};
|
||||
mockConfig.isCronEnabled = vi.fn().mockReturnValue(true);
|
||||
|
|
@ -3308,7 +3309,9 @@ describe('Session', () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
expect(scheduler.stop).toHaveBeenCalledTimes(1);
|
||||
// Token limit disables the scheduler (permanent for the session, so
|
||||
// a later LoopWakeup is rejected), not just stops it.
|
||||
expect(scheduler.disable).toHaveBeenCalledTimes(1);
|
||||
await vi.waitFor(() => {
|
||||
expect(mockClient.sessionUpdate).toHaveBeenCalledWith({
|
||||
sessionId: 'test-session-id',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue