LibreChat/config/__tests__/invite-user.spec.js
unsnow-iac 8374b8416a
Some checks are pending
Docker Dev Branch Images Build / build (Dockerfile, lc-dev, node) (push) Waiting to run
Docker Dev Branch Images Build / build (Dockerfile.multi, lc-dev-api, api-build) (push) Waiting to run
GitNexus Index / index (push) Waiting to run
GitNexus Index / post-index (push) Blocked by required conditions
📧 fix: Restore invite-user CLI (#14436)
* fix: restore invite-user CLI

* fix: guard createInvite failure shape in invite-user CLI

createInvite resolves to { message } on error rather than throwing, so the
CLI interpolated it into the register link as [object Object] and emailed
an unusable invite.

* fix: normalize invite email before token creation

findToken lowercases its email query but the Token schema has no lowercase
setter, so a mixed-case address passed to the CLI was stored verbatim and
the resulting invite could never be redeemed.

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2026-07-26 23:35:50 -04:00

16 lines
535 B
JavaScript

jest.mock('../connect', () => jest.fn(() => new Promise(() => {})));
describe('Invite user CLI', () => {
it('loads its runtime dependencies', () => {
const existingHandlers = new Set(process.listeners('uncaughtException'));
try {
expect(() => require('../invite-user')).not.toThrow();
} finally {
process
.listeners('uncaughtException')
.filter((handler) => !existingHandlers.has(handler))
.forEach((handler) => process.removeListener('uncaughtException', handler));
}
});
});