mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-19 14:33:38 +00:00
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
* fix: restore strict tenant startup and sign-in * test: preserve real middleware in auth route fixtures --------- Co-authored-by: Lia <lia@librechat.ai>
58 lines
2.2 KiB
JavaScript
58 lines
2.2 KiB
JavaScript
const mockWarnOnMissingSearchTokens = jest.fn();
|
|
const mockCheckAgentPermissionsMigration = jest.fn();
|
|
const mockCheckPromptPermissionsMigration = jest.fn();
|
|
|
|
jest.mock('@librechat/data-schemas', () => ({
|
|
logger: { error: jest.fn() },
|
|
runAsSystem: (fn) => fn(),
|
|
warnOnMissingSearchTokens: (...args) => mockWarnOnMissingSearchTokens(...args),
|
|
}));
|
|
jest.mock('@librechat/api', () => ({
|
|
logAgentMigrationWarning: jest.fn(),
|
|
logPromptMigrationWarning: jest.fn(),
|
|
checkAgentPermissionsMigration: (...args) => mockCheckAgentPermissionsMigration(...args),
|
|
checkPromptPermissionsMigration: (...args) => mockCheckPromptPermissionsMigration(...args),
|
|
}));
|
|
jest.mock('~/models', () => ({ findRoleByIdentifier: jest.fn() }));
|
|
|
|
const { logger } = require('@librechat/data-schemas');
|
|
const { checkMigrations } = require('../migration');
|
|
|
|
describe('checkMigrations', () => {
|
|
it('starts the search token probe while the permission checks are still running', async () => {
|
|
let finishAgentCheck;
|
|
mockCheckAgentPermissionsMigration.mockReturnValue(
|
|
new Promise((resolve) => {
|
|
finishAgentCheck = resolve;
|
|
}),
|
|
);
|
|
mockCheckPromptPermissionsMigration.mockResolvedValue({});
|
|
mockWarnOnMissingSearchTokens.mockResolvedValue(undefined);
|
|
|
|
const done = checkMigrations();
|
|
expect(mockWarnOnMissingSearchTokens).toHaveBeenCalledTimes(1);
|
|
|
|
finishAgentCheck({});
|
|
await done;
|
|
expect(mockCheckPromptPermissionsMigration).toHaveBeenCalledTimes(1);
|
|
});
|
|
});
|
|
|
|
it('labels permission check failures and still awaits the search probe', async () => {
|
|
const agentError = new Error('Agent check failed');
|
|
const promptError = new Error('Prompt check failed');
|
|
mockCheckAgentPermissionsMigration.mockRejectedValueOnce(agentError);
|
|
mockCheckPromptPermissionsMigration.mockRejectedValueOnce(promptError);
|
|
mockWarnOnMissingSearchTokens.mockResolvedValueOnce(undefined);
|
|
|
|
await expect(checkMigrations()).resolves.toBeUndefined();
|
|
|
|
expect(logger.error).toHaveBeenCalledWith(
|
|
'[checkMigrations] Failed to check agent permissions migration:',
|
|
agentError,
|
|
);
|
|
expect(logger.error).toHaveBeenCalledWith(
|
|
'[checkMigrations] Failed to check prompt permissions migration:',
|
|
promptError,
|
|
);
|
|
});
|