mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-21 15:33:45 +00:00
🥎 test: Handle Erasure Rejections Before Awaiting Database Reads (#18526)
The account-erasure recovery test started a favorite write that is expected to reject, then awaited a MongoDB read before handing the promise to the matcher. If PostgreSQL answered first the rejection had no handler and jest failed the test. The write now starts inside the awaited matcher.
This commit is contained in:
parent
5826626353
commit
4376b29740
1 changed files with 3 additions and 3 deletions
|
|
@ -231,14 +231,14 @@ realPostgres('delete-user CLI durable erasure recovery', () => {
|
|||
itemType: 'tool',
|
||||
itemId: 'after-recovery',
|
||||
});
|
||||
const add =
|
||||
const add = () =>
|
||||
origin === 'tenant'
|
||||
? schemas.tenantStorage.run({ tenantId: 'tenant-a' }, addFavorite)
|
||||
: addFavorite();
|
||||
if (outcome === 'cancel') {
|
||||
expect((await owned(id)).agentTriggerDeletionStartedAt).toBeUndefined();
|
||||
expect((await owned(id)).agentTriggerDeletionAttemptId).toBeUndefined();
|
||||
await expect(add).resolves.toEqual({ ok: true, added: true });
|
||||
await expect(add()).resolves.toEqual({ ok: true, added: true });
|
||||
expect(
|
||||
(
|
||||
await db.query(
|
||||
|
|
@ -249,7 +249,7 @@ realPostgres('delete-user CLI durable erasure recovery', () => {
|
|||
).toEqual([]);
|
||||
} else {
|
||||
expect(await owned(id)).toBeNull();
|
||||
await expect(add).rejects.toThrow('erasure');
|
||||
await expect(add()).rejects.toThrow('erasure');
|
||||
}
|
||||
} finally {
|
||||
await restarted.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue