Skip to content

Instantly share code, notes, and snippets.

@yashikagarg13
Last active April 4, 2017 15:28
Show Gist options
  • Save yashikagarg13/89e3c41f157c21328dc0ae5fbd13b05d to your computer and use it in GitHub Desktop.
Save yashikagarg13/89e3c41f157c21328dc0ae5fbd13b05d to your computer and use it in GitHub Desktop.
/************************************************************************
Helper Method name: transformToEvents.
Input: "talent-job-associations" object
{
type: "associations",
job: {...}, // Job Object
talentId: "1",
associations: [{
status: "Interested",
jobId: 961,
talentId: 3457,
respondedOn: "2016-04-19T04:36:42.480333",
createdOn: "2016-03-09T11:54:39.975600",
message: "Lacus ipsum.",
type: "job_invitations",
id: 203
}, ...] // Array of associations which could be job application, job-invitaion or job-recommendation
}
Output: Array of Events
Case 1: Talent is invited
main event - Invited
call for action - Interested or Not?
Case 2: Talent is invited and talent accepted invitaion
main event - Invited
action taken - Accepted
Case 3: Talent is invited, talent accepted invitaion, interviews are initiated
main event - Invited
action taken - Accepted
main event - Interviews
Case 4: Talent is invited, talent accepted invitaion, talent passed in interviews
main event - Invited
action taken - Accepted
main event - Interviews
main event - Hired
Case 5: Talent is invited, talent accepted invitaion, talent failed in interviews
main event - Invited
action taken - Accepted
main event - Interviews
main event - Not a good fit
Case 6: Talent is invited and talent declined invitaion
main event - Invited
action taken - Declined
Case 7: Talent is invited, talent accepted invitaion, interviews in process, job is closed.
main event - Invited
action taken - Declined
main event - Interviews
main event - Job Closed
Similarly, there will be different set of rules if talent has applied
for a job or is recommended by PTF memebers to a client
Tests are written in Jest using Enzyme DOM Manipulation library.
Tests are run against large set of data so that all the rules are covered.
Given method should return an object with maximum of three main events.
Call for action and action taken events are only in case of job-invitations.
Main Event has information about
1. dat of event occurrence,
2. if event is followed by another main event or call-for-action or action-take or none.
*************************************************************************/
describe "transformToEvents":
it "should return main event 'Invited' if association is of type job-invitations"
it "should return main event 'Invited' and a call for action if association is of type job-invitations and status is 'not responded'"
it "should return main event 'Invited' and a action taken of 'Accepted' if association is of type job-invitations and status is 'interested'"
it "should return main event 'Invited' and a action taken of 'Declined' if association is of type job-invitations and status is 'not interested'"
it "should return main event 'Interviews' if association is of type interviews"
it "should return main event 'Hired' if association is of type interviews and status is 'passed'"
it "should return main event 'Not a good fit' if association is of type interviews and status is 'failed'"
it "should return main event 'Job closed' irrespective of interviews status if job status is 'closed'"
.... (Different test cases for applications and recommendations)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment