Passed
Push — feature/screen-candidates-emai... ( a0a58c...49e0ac )
by Yonathan
07:48 queued 04:01
created

resources/assets/js/fakeData/fakeApplications.ts   A

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 226
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 149
mnd 2
bc 2
fnc 0
dl 0
loc 226
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
/* eslint camelcase: "off", @typescript-eslint/camelcase: "off" */
2
import {
3
  Application,
4
  ApplicationNormalized,
5
  ApplicationReview,
6
  Email,
7
} from "../models/types";
8
9
export const fakeApplicationReview = (
10
  overrides: Partial<ApplicationReview> = {},
11
): ApplicationReview => ({
12
  id: 1,
13
  job_application_id: 1,
14
  review_status_id: 6,
15
  notes: "Here's some notes.",
16
  created_at: new Date("2020-01-02"),
17
  updated_at: new Date("2020-01-02"),
18
  review_status: {
19
    id: 6,
20
    name: "assessment_required",
21
  },
22
  department_id: null,
23
  department: undefined,
24
  director_email_sent: false,
25
  reference_email_sent: false,
26
  ...overrides,
27
});
28
29
export const fakeApplicationNormalized = (
30
  overrides: Partial<ApplicationNormalized> = {},
31
): ApplicationNormalized => ({
32
  id: 1,
33
  job_poster_id: 1,
34
  application_status_id: 1,
35
  citizenship_declaration_id: 1,
36
  veteran_status_id: 1,
37
  preferred_language_id: 1,
38
  applicant_id: 1,
39
  applicant_snapshot_id: 1,
40
  submission_signature: "signed",
41
  submission_date: "2020-01-01",
42
  experience_saved: true,
43
  created_at: new Date("2020-01-01"),
44
  updated_at: new Date("2020-01-01"),
45
  veteran_status: {
46
    id: 1,
47
    name: "none",
48
  },
49
  citizenship_declaration: {
50
    id: 1,
51
    name: "citizen",
52
  },
53
  applicant: {
54
    id: 1,
55
    personal_website: "www.somesite.com",
56
    tagline: "Tagline",
57
    twitter_username: "someperson",
58
    linkedin_url: "linkedin.com/someperson",
59
    user_id: 1,
60
    created_at: new Date("2019-12-31"),
61
    updated_at: new Date("2019-12-31"),
62
    user: {
63
      id: 1,
64
      first_name: "Frankie",
65
      last_name: "Lambda",
66
      full_name: "Frankie Lambda",
67
      email: "[email protected]",
68
      is_confirmed: true,
69
      user_role_id: 1,
70
      created_at: new Date("2019-12-31"),
71
      updated_at: new Date("2019-12-31"),
72
      is_priority: false,
73
      not_in_gov: false,
74
      gov_email: "[email protected]",
75
      department_id: 1,
76
      user_role: {
77
        id: 1,
78
        key: "basic",
79
        created_at: new Date("2019-01-01"),
80
        updated_at: new Date("2019-01-01"),
81
        name: {
82
          en: "Applicant",
83
          fr: "Applicant",
84
        },
85
      },
86
    },
87
  },
88
  meets_essential_criteria: true,
89
  ...overrides,
90
});
91
92
export const fakeApplication = (
93
  overrides: Partial<Application> = {},
94
): Application => {
95
  const normalizedOverrides = {
96
    id: 1,
97
    ...overrides,
98
  };
99
  const reviewOverrides = {
100
    id: normalizedOverrides.id,
101
    job_application_id: normalizedOverrides.id,
102
    ...(normalizedOverrides.application_review ?? {}),
103
  };
104
  return {
105
    ...fakeApplicationNormalized(normalizedOverrides),
106
    application_review: fakeApplicationReview(reviewOverrides),
107
    ...overrides,
108
  };
109
};
110
111
export const fakeApplication1 = (
112
  overrides: Partial<Application> = {},
113
): Application => {
114
  return fakeApplication({ id: 1, ...overrides });
115
};
116
117
export const fakeApplication2 = (
118
  overrides: Partial<Application> = {},
119
): Application => {
120
  return fakeApplication({
121
    id: 2,
122
    job_poster_id: 2,
123
    applicant_id: 2,
124
    ...overrides,
125
  });
126
};
127
128
export const fakeApplication3 = (
129
  overrides: Partial<Application> = {},
130
): Application => {
131
  return fakeApplication({
132
    id: 3,
133
    job_poster_id: 3,
134
    applicant_id: 3,
135
    ...overrides,
136
  });
137
};
138
139
export const fakeApplications = (): Application[] => [
140
  fakeApplication1(),
141
  fakeApplication2(),
142
  fakeApplication3(),
143
];
144
145
const defaultEmailBody = `Dear *Name*:
146
147
GC Talent Reserve [link to website](https://talent.canada.ca) is a centrally coordinated, whole-of-government platform for talent mobilization in a crisis situation.
148
149
This exercise will only take 3-5 minutes of your time and will be a help to the Government of Canada in its efforts to respond to these exceptional circumstances. Please help others by reading this through and completing the questions.
150
151
*Name of candidate* has put their name forward to participate in the Government of Canada’s response to COVID-19. As part of the process to help determine how their skills may be best repurposed, they have identified you as a reference and the delegated authority who can approve their participation.
152
153
Do you approve *Name of candidate* for putting their name forward to the GC Talent Reserve?
154
155
Please confirm if *Name of candidate* is a current indeterminate employee or a term employee.
156
157
Please take 5 minutes to confirm if *Name of candidate* has the following skills by putting an “x” beside the appropriate level.
158
159
Skill #1
160
  * Strongly in evidence
161
  * Moderately in evidence
162
  * Weakly in evidence
163
  * Not in evidence
164
165
Skill #2
166
  * Strongly in evidence
167
  * Moderately in evidence
168
  * Weakly in evidence
169
  * Not in evidence
170
171
Skill #3
172
  * Strongly in evidence
173
  * Moderately in evidence
174
  * Weakly in evidence
175
  * Not in evidence
176
177
Overall, how would you feel about recommending this person for this type of work in Government? Please put an “x” beside the appropriate level.
178
179
Top recommendation
180
  - [ ] Strongly recommend
181
  - [ ] Recommend
182
  - [ ] Recommend with reservations
183
  - [ ] Do not recommend
184
185
Does the employee have any particular strengths you would like to highlight that might be relevant for assisting another department in critical need of talent for this type or work? (This question is optional)
186
187
Does the employee have any weaknesses you feel should be mentioned that might be relevant to the employee’s ability to be an asset to a department in critical need of talent for this type or work?  (This question is optional)
188
189
Thank you for helping the Government of Canada to navigate this exceptional circumstance.
190
191
If you have any questions, do not hesitate to email us at any time.
192
193
Best regards,
194
The Talent Cloud team`;
195
196
export const fakeReferenceEmail = (overrides: Partial<Email>): Email => ({
197
  from: [
198
    {
199
      name: "Talent Cloud",
200
      address: "[email protected]",
201
    },
202
  ],
203
  to: [
204
    {
205
      name: "Sam References",
206
      address: "[email protected]",
207
    },
208
  ],
209
  cc: [
210
    {
211
      name: "First HrAdvisor",
212
      address: "[email protected]",
213
    },
214
    {
215
      name: "Second HrAdvisor",
216
      address: "[email protected]",
217
    },
218
  ],
219
  bcc: [],
220
  subject: "Reference Requested - GC Talent Reserve",
221
  body: defaultEmailBody,
222
  ...overrides,
223
});
224
225
export default fakeApplications;
226