mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🔧 refactor: Centralize Collection Checks for Permissions Migration (#9565)
* 🔧 refactor: Centralize Collection Existence Checks for Permissions Migration * Replace individual collection existence checks with a unified function `ensureRequiredCollectionsExist` in the database utility module. * Update migration scripts for agents and prompts to utilize the new function, ensuring all required collections are verified for existence in a single call. * Remove redundant collection existence logic from migration files, improving code maintainability and clarity. * chore: import order in migration scripts * 🔧 test: Update Token Test Cases for Realistic Scenarios * Changed email in test data to 'user1-alt@example.com' for a more realistic scenario. * Clarified expectation comment for token retrieval to indicate it finds the only matching token based on criteria.
This commit is contained in:
parent
a2ff6613c5
commit
85aa3e7d9c
7 changed files with 67 additions and 102 deletions
|
@ -118,7 +118,7 @@ describe('Token Methods - Detailed Tests', () => {
|
|||
{
|
||||
token: 'token-3',
|
||||
userId: user1Id,
|
||||
email: 'user1@example.com',
|
||||
email: 'user1-alt@example.com', // Different email for realistic scenario
|
||||
createdAt: new Date(),
|
||||
expiresAt: new Date(Date.now() + 3600000),
|
||||
},
|
||||
|
@ -164,7 +164,7 @@ describe('Token Methods - Detailed Tests', () => {
|
|||
});
|
||||
|
||||
expect(found).toBeDefined();
|
||||
expect(found?.token).toBe('token-1'); // Should find first matching
|
||||
expect(found?.token).toBe('token-1'); // Should find the only token matching both criteria
|
||||
});
|
||||
|
||||
test('should return null for non-existent token', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue