mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 00:54:06 -08:00
5156313074
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run
32 lines
1 KiB
TypeScript
32 lines
1 KiB
TypeScript
import validator from 'validator';
|
|
|
|
import type { User } from '@/databases/entities/user';
|
|
|
|
import type { UserInvitationResult } from '../../shared/utils/users';
|
|
|
|
export function assertReturnedUserProps(user: User) {
|
|
expect(validator.isUUID(user.id)).toBe(true);
|
|
expect(user.email).toBeDefined();
|
|
expect(user.personalizationAnswers).toBeNull();
|
|
expect(user.password).toBeUndefined();
|
|
expect(user.isPending).toBe(false);
|
|
expect(user.apiKey).not.toBeDefined();
|
|
expect(user.globalScopes).toBeDefined();
|
|
expect(user.globalScopes).not.toHaveLength(0);
|
|
}
|
|
|
|
export const assertStoredUserProps = (user: User) => {
|
|
expect(user.firstName).toBeNull();
|
|
expect(user.lastName).toBeNull();
|
|
expect(user.personalizationAnswers).toBeNull();
|
|
expect(user.password).toBeNull();
|
|
expect(user.isPending).toBe(true);
|
|
};
|
|
|
|
export const assertUserInviteResult = (data: UserInvitationResult) => {
|
|
expect(validator.isUUID(data.user.id)).toBe(true);
|
|
expect(data.user.inviteAcceptUrl).toBeUndefined();
|
|
expect(data.user.email).toBeDefined();
|
|
expect(data.user.emailSent).toBe(true);
|
|
};
|