2023-11-27 02:56:06 -08:00
|
|
|
import type { PublicUser } from '@/Interfaces';
|
2023-11-29 04:55:41 -08:00
|
|
|
import type { User } from '@/databases/entities/User';
|
2023-11-27 02:56:06 -08:00
|
|
|
|
|
|
|
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();
|
2024-01-24 04:38:57 -08:00
|
|
|
expect(user.role).toBeDefined();
|
2023-11-27 02:56:06 -08:00
|
|
|
};
|
2023-11-29 04:55:41 -08:00
|
|
|
|
2024-01-29 07:15:30 -08:00
|
|
|
export type UserInvitationResult = {
|
2023-11-29 04:55:41 -08:00
|
|
|
user: Pick<User, 'id' | 'email'> & { inviteAcceptUrl: string; emailSent: boolean };
|
|
|
|
error?: string;
|
|
|
|
};
|