mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
fix: use deterministic timestamps in convoStructure test
MongoDB 8.x (from mongodb-memory-server v11) no longer guarantees insertion-order return for documents with identical timestamps. Use sequential timestamps with overrideTimestamp to ensure buildTree processes parents before children.
This commit is contained in:
parent
7e19ca197f
commit
7dcd5f1751
1 changed files with 3 additions and 3 deletions
|
|
@ -116,11 +116,11 @@ describe('Conversation Structure Tests', () => {
|
|||
conversationId,
|
||||
user: userId,
|
||||
text: `Message ${i}`,
|
||||
createdAt: new Date(Date.now() + (i % 2 === 0 ? i * 500000 : -i * 500000)),
|
||||
createdAt: new Date(Date.now() + i * 1000),
|
||||
}));
|
||||
|
||||
// Save messages with new timestamps being generated (message objects ignored)
|
||||
await bulkSaveMessages(messages);
|
||||
// Save messages preserving original timestamps so sort order is deterministic
|
||||
await bulkSaveMessages(messages, true);
|
||||
|
||||
// Retrieve messages (this will sort by createdAt, but it shouldn't matter now)
|
||||
const retrievedMessages = await getMessages({ conversationId, user: userId });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue