Skip to content

Instantly share code, notes, and snippets.

@yashikagarg13
Created March 26, 2017 16:50
Show Gist options
  • Save yashikagarg13/0a1d61b06d8a3fa44fc1824cc65f41fa to your computer and use it in GitHub Desktop.
Save yashikagarg13/0a1d61b06d8a3fa44fc1824cc65f41fa 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: Stream of Events
1. Invited
main event - Invited
call for action - Interested or Not?
2. Invited => Accepted
main event - Invited
action taken - Accepted
3. Invited => Accepted => Interviews
main event - Invited
action taken - Accepted
main event - Interviews
4. Invited => Accepted => Interviews Passed => Hired (Association Archived)
main event - Invited
action taken - Accepted
main event - Interviews
main event - Hired
5. Invited => Accepted => Interviews Passed => Failed (Association Archived)
main event - Invited
action taken - Accepted
main event - Interviews
main event - Not a good fit
6. Invited => Declined (Association Archived)
main event - Invited
action taken - Declined
7. Invited => Accepted => Interviews => Job Closed (Association Archived)
main event - Invited
action taken - Declined
main event - Interviews
main event - Job Closed
A different set of rules as per process for application and recommendation.
Test written in Jest using Enzyme DOM Manipulation library.
Tests are run using large set of data so that all the rules are covered.
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 on
when that event occurred,
followed by 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