Passed
Push — dev ( 5799c4...9b6d5e )
by Yonathan
03:59 queued 11s
created

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

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 232
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 155
mnd 2
bc 2
fnc 0
dl 0
loc 232
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
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
  share_with_managers: false,
46
  veteran_status: {
47
    id: 1,
48
    name: "none",
49
  },
50
  citizenship_declaration: {
51
    id: 1,
52
    name: "citizen",
53
  },
54
  applicant: {
55
    id: 1,
56
    personal_website: "www.somesite.com",
57
    tagline: "Tagline",
58
    twitter_username: "someperson",
59
    linkedin_url: "linkedin.com/someperson",
60
    user_id: 1,
61
    created_at: new Date("2019-12-31"),
62
    updated_at: new Date("2019-12-31"),
63
    user: {
64
      id: 1,
65
      first_name: "Frankie",
66
      last_name: "Lambda",
67
      full_name: "Frankie Lambda",
68
      email: "[email protected]",
69
      is_confirmed: true,
70
      user_role_id: 1,
71
      created_at: new Date("2019-12-31"),
72
      updated_at: new Date("2019-12-31"),
73
      is_priority: false,
74
      not_in_gov: false,
75
      gov_email: "[email protected]",
76
      department_id: 1,
77
      contact_language: "en",
78
      job_alerts: true,
79
      user_role: {
80
        id: 1,
81
        key: "basic",
82
        created_at: new Date("2019-01-01"),
83
        updated_at: new Date("2019-01-01"),
84
        name: {
85
          en: "Applicant",
86
          fr: "Applicant",
87
        },
88
      },
89
    },
90
  },
91
  meets_essential_criteria: true,
92
  language_requirement_confirmed: true,
93
  language_test_confirmed: true,
94
  education_requirement_confirmed: true,
95
  ...overrides,
96
});
97
98
export const fakeApplication = (
99
  overrides: Partial<Application> = {},
100
): Application => {
101
  const normalizedOverrides = {
102
    id: 1,
103
    ...overrides,
104
  };
105
  const reviewOverrides = {
106
    id: normalizedOverrides.id,
107
    job_application_id: normalizedOverrides.id,
108
    ...(normalizedOverrides.application_review ?? {}),
109
  };
110
  return {
111
    ...fakeApplicationNormalized(normalizedOverrides),
112
    application_review: fakeApplicationReview(reviewOverrides),
113
    ...overrides,
114
  };
115
};
116
117
export const fakeApplication1 = (
118
  overrides: Partial<Application> = {},
119
): Application => {
120
  return fakeApplication({ id: 1, ...overrides });
121
};
122
123
export const fakeApplication2 = (
124
  overrides: Partial<Application> = {},
125
): Application => {
126
  return fakeApplication({
127
    id: 2,
128
    job_poster_id: 2,
129
    applicant_id: 2,
130
    ...overrides,
131
  });
132
};
133
134
export const fakeApplication3 = (
135
  overrides: Partial<Application> = {},
136
): Application => {
137
  return fakeApplication({
138
    id: 3,
139
    job_poster_id: 3,
140
    applicant_id: 3,
141
    ...overrides,
142
  });
143
};
144
145
export const fakeApplications = (): Application[] => [
146
  fakeApplication1(),
147
  fakeApplication2(),
148
  fakeApplication3(),
149
];
150
151
const defaultEmailBody = `Dear *Name*:
152
153
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.
154
155
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.
156
157
*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.
158
159
Do you approve *Name of candidate* for putting their name forward to the GC Talent Reserve?
160
161
Please confirm if *Name of candidate* is a current indeterminate employee or a term employee.
162
163
Please take 5 minutes to confirm if *Name of candidate* has the following skills by putting an “x” beside the appropriate level.
164
165
Skill #1
166
  * Strongly in evidence
167
  * Moderately in evidence
168
  * Weakly in evidence
169
  * Not in evidence
170
171
Skill #2
172
  * Strongly in evidence
173
  * Moderately in evidence
174
  * Weakly in evidence
175
  * Not in evidence
176
177
Skill #3
178
  * Strongly in evidence
179
  * Moderately in evidence
180
  * Weakly in evidence
181
  * Not in evidence
182
183
Overall, how would you feel about recommending this person for this type of work in Government? Please put an “x” beside the appropriate level.
184
185
Top recommendation
186
  - [ ] Strongly recommend
187
  - [ ] Recommend
188
  - [ ] Recommend with reservations
189
  - [ ] Do not recommend
190
191
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)
192
193
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)
194
195
Thank you for helping the Government of Canada to navigate this exceptional circumstance.
196
197
If you have any questions, do not hesitate to email us at any time.
198
199
Best regards,
200
The Talent Cloud team`;
201
202
export const fakeReferenceEmail = (overrides: Partial<Email>): Email => ({
203
  from: [
204
    {
205
      name: "Talent Cloud",
206
      address: "[email protected]",
207
    },
208
  ],
209
  to: [
210
    {
211
      name: "Sam References",
212
      address: "[email protected]",
213
    },
214
  ],
215
  cc: [
216
    {
217
      name: "First HrAdvisor",
218
      address: "[email protected]",
219
    },
220
    {
221
      name: "Second HrAdvisor",
222
      address: "[email protected]",
223
    },
224
  ],
225
  bcc: [],
226
  subject: "Reference Requested - GC Talent Reserve",
227
  body: defaultEmailBody,
228
  ...overrides,
229
});
230
231
export default fakeApplications;
232