n8n/packages/cli/test/integration/shared/utils/users.ts
Iván Ovejero 9e93980957
fix(core): Prevent calling internal hook email event if emailing is disabled (#8462)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-01-29 16:15:30 +01:00

22 lines
735 B
TypeScript

import type { PublicUser } from '@/Interfaces';
import type { User } from '@/databases/entities/User';
export const validateUser = (user: PublicUser) => {
expect(typeof user.id).toBe('string');
expect(user.email).toBeDefined();
expect(user.firstName).toBeDefined();
expect(user.lastName).toBeDefined();
expect(typeof user.isOwner).toBe('boolean');
expect(user.isPending).toBe(false);
expect(user.signInType).toBe('email');
expect(user.settings).toBe(null);
expect(user.personalizationAnswers).toBeNull();
expect(user.password).toBeUndefined();
expect(user.role).toBeDefined();
};
export type UserInvitationResult = {
user: Pick<User, 'id' | 'email'> & { inviteAcceptUrl: string; emailSent: boolean };
error?: string;
};