test(core): Move unit tests closer to testable components (no-changelog) (#10287)

This commit is contained in:
Tomi Turtiainen
2024-08-05 12:12:25 +03:00
committed by GitHub
parent 8131d66f8c
commit afa43e75f6
80 changed files with 95 additions and 105 deletions

View File

@@ -0,0 +1,29 @@
import { randomInt } from 'n8n-workflow';
import { User } from '@db/entities/User';
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { Project } from '@db/entities/Project';
import {
randomCredentialPayload,
randomEmail,
randomName,
uniqueId,
} from '../integration/shared/random';
export const mockCredential = (): CredentialsEntity =>
Object.assign(new CredentialsEntity(), randomCredentialPayload());
export const mockUser = (): User =>
Object.assign(new User(), {
id: randomInt(1000),
email: randomEmail(),
firstName: randomName(),
lastName: randomName(),
});
export const mockProject = (): Project =>
Object.assign(new Project(), {
id: uniqueId(),
type: 'personal',
name: 'Nathan Fillion <nathan.fillion@n8n.io>',
});