Skip to content

Commit f34e1a7

Browse files
Merge pull request #35 from topcoder-platform/hotfix/patch-1.5.3.1
[DEV] Patch 1.5.3.1, part 2
2 parents 0b83623 + c7a55dc commit f34e1a7

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

src/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ global.Promise = require('bluebird')
66

77
Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly')
88
Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled')
9-
Joi.jobCandidateStatus = () => Joi.string().valid('open', 'selected', 'shortlist', 'rejected', 'cancelled', 'interview')
9+
Joi.jobCandidateStatus = () => Joi.string().valid('open', 'selected', 'shortlist', 'rejected', 'cancelled', 'interview', 'topcoder-rejected')
1010
Joi.workload = () => Joi.string().valid('full-time', 'fractional')
1111
Joi.title = () => Joi.string().max(128)
1212
Joi.paymentStatus = () => Joi.string().valid('pending', 'partially-completed', 'completed', 'cancelled')

test/unit/test.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,33 @@ describe('Zapier Logic Tests', () => {
250250
helper.postMessageViaWebhook.callCount.should.equal(0)
251251
})
252252

253-
it('should not post to Zapier if status is changed to "selected" (not "rejected" or "shortlist")', async () => {
253+
it('should not post to Zapier if status is changed to "interview" (not "rejected" or "shortlist")', async () => {
254254
const previousData = _.assign({}, testData.messages.JobCandidate.create.message.payload, { status: 'open', externalId: '123' })
255255
const updateMessage = _.assign({}, testData.messages.JobCandidate.update.message, {
256-
payload: _.assign({}, testData.messages.JobCandidate.update.message.payload, { status: 'selected', externalId: '123' })
256+
payload: _.assign({}, testData.messages.JobCandidate.update.message.payload, { status: 'interview', externalId: '123' })
257+
})
258+
259+
await testHelper.esClient.create({
260+
index: config.esConfig.ES_INDEX_JOB,
261+
id: previousData.id,
262+
body: previousData,
263+
refresh: 'true'
264+
})
265+
await testHelper.esClient.create({
266+
index: config.esConfig.ES_INDEX_JOB_CANDIDATE,
267+
id: testData.messages.Job.create.message.payload.id,
268+
body: testData.messages.Job.create.message.payload,
269+
refresh: 'true'
270+
})
271+
await services[`JobCandidateProcessorService`].processUpdate(updateMessage, transactionId)
272+
273+
helper.postMessageViaWebhook.callCount.should.equal(0)
274+
})
275+
276+
it('should not post to Zapier if status is changed to "topcoder-rejected" (not "rejected" or "shortlist")', async () => {
277+
const previousData = _.assign({}, testData.messages.JobCandidate.create.message.payload, { status: 'open', externalId: '123' })
278+
const updateMessage = _.assign({}, testData.messages.JobCandidate.update.message, {
279+
payload: _.assign({}, testData.messages.JobCandidate.update.message.payload, { status: 'topcoder-rejected', externalId: '123' })
257280
})
258281

259282
await testHelper.esClient.create({

0 commit comments

Comments
 (0)