test: reset MCP cache mock between cases

This commit is contained in:
Danny Avila 2026-08-17 11:05:43 -04:00
parent fa98a47a01
commit 02c8915833

View file

@ -228,6 +228,12 @@ describe('MCP Routes', () => {
currentUser = undefined;
mockResolveAllMcpConfigs.mockResolvedValue({});
mockResolveMcpConfigNames.mockResolvedValue([]);
// `clearAllMocks` preserves queued `mockReturnValueOnce` entries. A callback
// test can legitimately leave one unconsumed, which then masks a later test's
// default implementation when this file shares a CI shard with other suites.
// Reset the cache accessor itself so every test starts from a deterministic
// default and can opt into a one-shot value deliberately.
require('~/cache').getLogStores.mockReset().mockReturnValue({});
const { MCPOAuthHandler } = require('@librechat/api');
const { getTenantId } = require('@librechat/data-schemas');
getTenantId.mockReturnValue(undefined);