Passed
Pull Request — master (#350)
by
unknown
06:30 queued 04:29
created

JohnFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 13
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A entity 0 12 1
1
import { Factory } from '@concepta/typeorm-seeding';
2
import { faker } from '@faker-js/faker';
3
import { User, UserRole } from 'src/Domain/HumanResource/User/User.entity';
4
5
export class UserFactory extends Factory<User> {
6
  protected async entity(): Promise<User> {
7
    const user = new User(
8
      faker.name.firstName('female'),
9
      faker.name.lastName('female'),
10
      faker.internet.email(),
11
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
12
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
13
      UserRole.COOPERATOR
14
    );
15
    return user;
16
  }
17
}
18
19
export class JohnFactory extends Factory<User> {
20
  // required
21
  protected async entity(): Promise<User> {
22
    //create John Doe
23
    const user = new User(
24
      'john',
25
      'doe',
26
      '[email protected]',
27
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
28
      '$argon2i$v=19$m=4096,t=3,p=1$slHh/xhoh8SvIjApBHSZnA$hqsry11DeWbNYsFnzADPkYOP2WQrf0yqDXGC3xjSX9A',
29
      UserRole.COOPERATOR
30
    );
31
    return user;
32
  }
33
}
34