mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-19 22:43:38 +00:00
🥁 test: Stabilize Host Edit Responsiveness Assertions (#16727)
Co-authored-by: Lia <lia@librechat.ai>
This commit is contained in:
parent
38a9dab3f5
commit
6298bfc920
2 changed files with 30 additions and 7 deletions
|
|
@ -177,6 +177,35 @@ describe('worker lifecycle', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it.each([false, true])(
|
||||
'keeps timers running while a worker reply is pending, warm=%s',
|
||||
async (warm) => {
|
||||
const processor = createHostEditProcessor(fixture);
|
||||
const controller = new AbortController();
|
||||
try {
|
||||
if (warm) await processor.apply('ready', [edit]);
|
||||
let settled = false;
|
||||
const pending = processor.apply('wait', [edit], undefined, controller.signal).then(
|
||||
() => {
|
||||
settled = true;
|
||||
return 'completed';
|
||||
},
|
||||
(error: Error) => {
|
||||
settled = true;
|
||||
return error.name;
|
||||
},
|
||||
);
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
expect(settled).toBe(false);
|
||||
controller.abort();
|
||||
await expect(pending).resolves.toBe('AbortError');
|
||||
} finally {
|
||||
controller.abort();
|
||||
await processor.close();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it('has no queue and releases capacity only after cancellation terminates the worker', async () => {
|
||||
const processor = createHostEditProcessor(fixture);
|
||||
const controller = new AbortController();
|
||||
|
|
|
|||
|
|
@ -5638,7 +5638,7 @@ describe('createToolExecuteHandler', () => {
|
|||
];
|
||||
|
||||
it.each(['SKILL.md', 'references/a.md'])(
|
||||
'rejects compact amplification atomically for %s without starving timers',
|
||||
'rejects compact amplification atomically for %s',
|
||||
async (file) => {
|
||||
const updateSkill = jest.fn();
|
||||
const saveSkillFileContent = jest.fn();
|
||||
|
|
@ -5663,10 +5663,6 @@ describe('createToolExecuteHandler', () => {
|
|||
updateSkill,
|
||||
saveSkillFileContent,
|
||||
});
|
||||
let timerFired = false;
|
||||
const timer = setTimeout(() => {
|
||||
timerFired = true;
|
||||
}, 0);
|
||||
const [result] = await invokeHandler(handler, [
|
||||
{
|
||||
id: 'amplification',
|
||||
|
|
@ -5674,10 +5670,8 @@ describe('createToolExecuteHandler', () => {
|
|||
args: { path: `skills/bounded-skill/${file}`, edits: amplificationEdits() },
|
||||
},
|
||||
]);
|
||||
clearTimeout(timer);
|
||||
expect(result.status).toBe('error');
|
||||
expect(result.errorMessage).toContain('budget exceeded');
|
||||
expect(timerFired).toBe(true);
|
||||
expect(updateSkill).not.toHaveBeenCalled();
|
||||
expect(saveSkillFileContent).not.toHaveBeenCalled();
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue