Passed
Push — dev ( e70e99...cb4e33 )
by
unknown
03:46
created

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

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 229
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 152
mnd 2
bc 2
fnc 0
dl 0
loc 229
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
  language_requirement_confirmed: true,
90
  language_test_confirmed: true,
91
  education_requirement_confirmed: true,
92
  ...overrides,
93
});
94
95
export const fakeApplication = (
96
  overrides: Partial<Application> = {},
97
): Application => {
98
  const normalizedOverrides = {
99
    id: 1,
100
    ...overrides,
101
  };
102
  const reviewOverrides = {
103
    id: normalizedOverrides.id,
104
    job_application_id: normalizedOverrides.id,
105
    ...(normalizedOverrides.application_review ?? {}),
106
  };
107
  return {
108
    ...fakeApplicationNormalized(normalizedOverrides),
109
    application_review: fakeApplicationReview(reviewOverrides),
110
    ...overrides,
111
  };
112
};
113
114
export const fakeApplication1 = (
115
  overrides: Partial<Application> = {},
116
): Application => {
117
  return fakeApplication({ id: 1, ...overrides });
118
};
119
120
export const fakeApplication2 = (
121
  overrides: Partial<Application> = {},
122
): Application => {
123
  return fakeApplication({
124
    id: 2,
125
    job_poster_id: 2,
126
    applicant_id: 2,
127
    ...overrides,
128
  });
129
};
130
131
export const fakeApplication3 = (
132
  overrides: Partial<Application> = {},
133
): Application => {
134
  return fakeApplication({
135
    id: 3,
136
    job_poster_id: 3,
137
    applicant_id: 3,
138
    ...overrides,
139
  });
140
};
141
142
export const fakeApplications = (): Application[] => [
143
  fakeApplication1(),
144
  fakeApplication2(),
145
  fakeApplication3(),
146
];
147
148
const defaultEmailBody = `Dear *Name*:
149
150
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.
151
152
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.
153
154
*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.
155
156
Do you approve *Name of candidate* for putting their name forward to the GC Talent Reserve?
157
158
Please confirm if *Name of candidate* is a current indeterminate employee or a term employee.
159
160
Please take 5 minutes to confirm if *Name of candidate* has the following skills by putting an “x” beside the appropriate level.
161
162
Skill #1
163
  * Strongly in evidence
164
  * Moderately in evidence
165
  * Weakly in evidence
166
  * Not in evidence
167
168
Skill #2
169
  * Strongly in evidence
170
  * Moderately in evidence
171
  * Weakly in evidence
172
  * Not in evidence
173
174
Skill #3
175
  * Strongly in evidence
176
  * Moderately in evidence
177
  * Weakly in evidence
178
  * Not in evidence
179
180
Overall, how would you feel about recommending this person for this type of work in Government? Please put an “x” beside the appropriate level.
181
182
Top recommendation
183
  - [ ] Strongly recommend
184
  - [ ] Recommend
185
  - [ ] Recommend with reservations
186
  - [ ] Do not recommend
187
188
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)
189
190
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)
191
192
Thank you for helping the Government of Canada to navigate this exceptional circumstance.
193
194
If you have any questions, do not hesitate to email us at any time.
195
196
Best regards,
197
The Talent Cloud team`;
198
199
export const fakeReferenceEmail = (overrides: Partial<Email>): Email => ({
200
  from: [
201
    {
202
      name: "Talent Cloud",
203
      address: "[email protected]",
204
    },
205
  ],
206
  to: [
207
    {
208
      name: "Sam References",
209
      address: "[email protected]",
210
    },
211
  ],
212
  cc: [
213
    {
214
      name: "First HrAdvisor",
215
      address: "[email protected]",
216
    },
217
    {
218
      name: "Second HrAdvisor",
219
      address: "[email protected]",
220
    },
221
  ],
222
  bcc: [],
223
  subject: "Reference Requested - GC Talent Reserve",
224
  body: defaultEmailBody,
225
  ...overrides,
226
});
227
228
export default fakeApplications;
229