fix(memory): resolve Vitest false positive for expected rejection (#3893)

Wrap the addObservations call in an async closure before asserting with
.rejects.toThrow(). This prevents Vitest's global unhandled rejection
handler from capturing the expected error before the assertion can
intercept it, eliminating the false-positive "Unhandled Errors" warning
that was failing CI.

Fixes #3073
This commit is contained in:
Yusufhan Sacak 2026-09-02 18:03:51 +03:00 • committed by GitHub
commit cce08de417
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -146,11 +146,11 @@ describe('KnowledgeGraphManager', () => {
});
it('should throw error for non-existent entity', async () => {
await expect(
manager.addObservations([
await expect(async () => {
await manager.addObservations([
{ entityName: 'NonExistent', contents: ['some observation'] },
])
).rejects.toThrow('Entity with name NonExistent not found');
]);
}).rejects.toThrow('Entity with name NonExistent not found');
});
});