Passed
Push — task/improve-find-skills-modal... ( 114b93...aefbfa )
by Yonathan
06:27
created

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

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 358
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 264
mnd 2
bc 2
fnc 0
dl 0
loc 358
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
1
/* eslint camelcase: "off" */
2
import { ApplicationStep, ProgressBarStatus } from "../models/lookupConstants";
3
import {
4
  Application,
5
  ApplicationNormalized,
6
  ApplicationReview,
7
  Email,
8
  ReviewStatus,
9
} from "../models/types";
10
11
export const reviewStatuses: ReviewStatus[] = [
12
  { id: 1, name: "screened_out" },
13
  { id: 2, name: "still_thinking" },
14
  { id: 3, name: "still_in" },
15
];
16
17
export const fakeApplicationReview = (
18
  overrides: Partial<ApplicationReview> = {},
19
): ApplicationReview => ({
20
  id: 1,
21
  job_application_id: 1,
22
  review_status_id: 6,
23
  notes: "Here's some notes.",
24
  created_at: new Date("2020-01-02"),
25
  updated_at: new Date("2020-01-02"),
26
  review_status: {
27
    id: 6,
28
    name: "assessment_required",
29
  },
30
  department_id: null,
31
  department: undefined,
32
  director_email_sent: false,
33
  reference_email_sent: false,
34
  ...overrides,
35
});
36
37
export const fakeApplicationNormalized = (
38
  overrides: Partial<ApplicationNormalized> = {},
39
): ApplicationNormalized => ({
40
  id: 1,
41
  job_poster_id: 1,
42
  application_status_id: 1,
43
  citizenship_declaration_id: 1,
44
  veteran_status_id: 1,
45
  preferred_language_id: 1,
46
  applicant_id: 1,
47
  applicant_snapshot_id: 1,
48
  submission_signature: "signed",
49
  submission_date: "2020-01-01",
50
  experience_saved: true,
51
  created_at: new Date("2020-01-01"),
52
  updated_at: new Date("2020-01-01"),
53
  share_with_managers: false,
54
  language_requirement_confirmed: true,
55
  language_test_confirmed: true,
56
  education_requirement_confirmed: true,
57
  version_id: 2,
58
  user_email: null,
59
  user_name: null,
60
  veteran_status: {
61
    id: 1,
62
    name: "none",
63
  },
64
  citizenship_declaration: {
65
    id: 1,
66
    name: "citizen",
67
  },
68
  applicant: {
69
    id: 1,
70
    personal_website: "www.somesite.com",
71
    tagline: "Tagline",
72
    twitter_username: "someperson",
73
    linkedin_url: "linkedin.com/someperson",
74
    user_id: 1,
75
    created_at: new Date("2019-12-31"),
76
    updated_at: new Date("2019-12-31"),
77
    user: {
78
      id: 1,
79
      first_name: "Frankie",
80
      last_name: "Lambda",
81
      full_name: "Frankie Lambda",
82
      email: "[email protected]",
83
      is_confirmed: true,
84
      user_role_id: 1,
85
      created_at: new Date("2019-12-31"),
86
      updated_at: new Date("2019-12-31"),
87
      is_priority: false,
88
      not_in_gov: false,
89
      gov_email: "[email protected]",
90
      department_id: 1,
91
      contact_language: "en",
92
      job_alerts: true,
93
      user_role: {
94
        id: 1,
95
        key: "basic",
96
        created_at: new Date("2019-01-01"),
97
        updated_at: new Date("2019-01-01"),
98
        name: {
99
          en: "Applicant",
100
          fr: "Applicant",
101
        },
102
      },
103
    },
104
  },
105
  meets_essential_criteria: true,
106
  ...overrides,
107
});
108
109
export const fakeApplication = (
110
  overrides: Partial<Application> = {},
111
): Application => {
112
  const normalizedOverrides = {
113
    id: 1,
114
    ...overrides,
115
  };
116
  const reviewOverrides = {
117
    id: normalizedOverrides.id,
118
    job_application_id: normalizedOverrides.id,
119
    ...(normalizedOverrides.application_review ?? {}),
120
  };
121
  return {
122
    ...fakeApplicationNormalized(normalizedOverrides),
123
    application_review: fakeApplicationReview(reviewOverrides),
124
    ...overrides,
125
  };
126
};
127
128
export const fakeApplication1 = (
129
  overrides: Partial<Application> = {},
130
): Application => {
131
  return fakeApplication({ id: 1, ...overrides });
132
};
133
134
export const fakeApplication2 = (
135
  overrides: Partial<Application> = {},
136
): Application => {
137
  return fakeApplication({
138
    id: 2,
139
    job_poster_id: 2,
140
    applicant_id: 2,
141
    ...overrides,
142
  });
143
};
144
145
export const fakeApplication3 = (
146
  overrides: Partial<Application> = {},
147
): Application => {
148
  return fakeApplication({
149
    id: 3,
150
    job_poster_id: 3,
151
    applicant_id: 3,
152
    ...overrides,
153
  });
154
};
155
156
export const fakeApplication4 = (
157
  overrides: Partial<Application> = {},
158
): Application => {
159
  return fakeApplication({
160
    id: 4,
161
    job_poster_id: 3,
162
    applicant_id: 4,
163
    applicant: {
164
      ...fakeApplicationNormalized().applicant,
165
      id: 4,
166
      user: {
167
        ...fakeApplicationNormalized().applicant.user,
168
        first_name: "Brianne",
169
        last_name: "Rice",
170
        full_name: "Brianne Rice",
171
        email: "[email protected]",
172
        gov_email: "[email protected]",
173
      },
174
    },
175
    application_review: {
176
      ...fakeApplicationReview(),
177
      id: 4,
178
      job_application_id: 4,
179
      review_status_id: reviewStatuses[1].id,
180
      notes:
181
        "Still considering this candidate pending completion of assessment.",
182
      review_status: reviewStatuses[1],
183
    },
184
    ...overrides,
185
  });
186
};
187
188
export const fakeApplication5 = (
189
  overrides: Partial<Application> = {},
190
): Application => {
191
  return fakeApplication({
192
    id: 5,
193
    job_poster_id: 3,
194
    applicant_id: 5,
195
    applicant: {
196
      ...fakeApplicationNormalized().applicant,
197
      id: 5,
198
      user: {
199
        ...fakeApplicationNormalized().applicant.user,
200
        first_name: "Magnus",
201
        last_name: "Bogan",
202
        full_name: "Magnus Bogan",
203
        email: "[email protected]",
204
        gov_email: "[email protected]",
205
      },
206
    },
207
    application_review: {
208
      ...fakeApplicationReview(),
209
      id: 5,
210
      job_application_id: 5,
211
      review_status_id: reviewStatuses[1].id,
212
      notes:
213
        "Still considering this candidate pending completion of assessment.",
214
      review_status: reviewStatuses[1],
215
    },
216
    ...overrides,
217
  });
218
};
219
220
export const fakeApplication6 = (
221
  overrides: Partial<Application> = {},
222
): Application => {
223
  return fakeApplication({
224
    id: 6,
225
    job_poster_id: 3,
226
    applicant_id: 6,
227
    applicant: {
228
      ...fakeApplicationNormalized().applicant,
229
      id: 6,
230
      user: {
231
        ...fakeApplicationNormalized().applicant.user,
232
        first_name: "Henriette",
233
        last_name: "Brackus",
234
        full_name: "Henriette Brackus",
235
        email: "[email protected]",
236
        gov_email: "[email protected]",
237
      },
238
    },
239
    application_review: {
240
      ...fakeApplicationReview(),
241
      id: 6,
242
      job_application_id: 6,
243
      review_status_id: reviewStatuses[0].id,
244
      notes:
245
        "This candidate did not successfully complete the written assessment.",
246
      review_status: reviewStatuses[0],
247
    },
248
    ...overrides,
249
  });
250
};
251
252
export const fakeApplications = (): Application[] => [
253
  fakeApplication1(),
254
  fakeApplication2(),
255
  fakeApplication3(),
256
  fakeApplication4(),
257
  fakeApplication5(),
258
  fakeApplication6(),
259
];
260
261
const defaultEmailBody = `Dear *Name*:
262
263
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.
264
265
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.
266
267
*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.
268
269
Do you approve *Name of candidate* for putting their name forward to the GC Talent Reserve?
270
271
Please confirm if *Name of candidate* is a current indeterminate employee or a term employee.
272
273
Please take 5 minutes to confirm if *Name of candidate* has the following skills by putting an “x” beside the appropriate level.
274
275
Skill #1
276
  * Strongly in evidence
277
  * Moderately in evidence
278
  * Weakly in evidence
279
  * Not in evidence
280
281
Skill #2
282
  * Strongly in evidence
283
  * Moderately in evidence
284
  * Weakly in evidence
285
  * Not in evidence
286
287
Skill #3
288
  * Strongly in evidence
289
  * Moderately in evidence
290
  * Weakly in evidence
291
  * Not in evidence
292
293
Overall, how would you feel about recommending this person for this type of work in Government? Please put an “x” beside the appropriate level.
294
295
Top recommendation
296
  - [ ] Strongly recommend
297
  - [ ] Recommend
298
  - [ ] Recommend with reservations
299
  - [ ] Do not recommend
300
301
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)
302
303
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)
304
305
Thank you for helping the Government of Canada to navigate this exceptional circumstance.
306
307
If you have any questions, do not hesitate to email us at any time.
308
309
Best regards,
310
The Talent Cloud team`;
311
312
export const fakeReferenceEmail = (overrides: Partial<Email>): Email => ({
313
  from: [
314
    {
315
      name: "Talent Cloud",
316
      address: "[email protected]",
317
    },
318
  ],
319
  to: [
320
    {
321
      name: "Sam References",
322
      address: "[email protected]",
323
    },
324
  ],
325
  cc: [
326
    {
327
      name: "First HrAdvisor",
328
      address: "[email protected]",
329
    },
330
    {
331
      name: "Second HrAdvisor",
332
      address: "[email protected]",
333
    },
334
  ],
335
  bcc: [],
336
  subject: "Reference Requested - GC Talent Reserve",
337
  body: defaultEmailBody,
338
  ...overrides,
339
});
340
341
export const fakeJobApplicationSteps = (
342
  basic: ProgressBarStatus = "default",
343
  experience: ProgressBarStatus = "default",
344
  fit: ProgressBarStatus = "default",
345
  skills: ProgressBarStatus = "default",
346
  review: ProgressBarStatus = "default",
347
  submission: ProgressBarStatus = "default",
348
): { [step in ApplicationStep]: ProgressBarStatus } => ({
349
  basic,
350
  experience,
351
  fit,
352
  skills,
353
  review,
354
  submission,
355
});
356
357
export default fakeApplications;
358