Skip to content

Commit 6c79e52

Browse files
authored
unit tests must pass (topcoder-platform#17)
Fixes topcoder-platform#5 Signed-off-by: Alessandro De Blasis <[email protected]>
1 parent 375b0a8 commit 6c79e52

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

test/unit/WorkPeriodPaymentService.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('workPeriodPayment service test', () => {
3232
it('create work period success', async () => {
3333
const stubWorkPeriodFindById = sinon.stub(models.WorkPeriod, 'findOne').callsFake(async () => testData.workPeriodPayment01.workPeriodWithPayments)
3434
const stubUpdateWorkPeriod = sinon.stub(testData.workPeriodPayment01.workPeriodWithPayments, 'update').callsFake(async () => testData.workPeriodPayment01.workPeriodUpdateResponse)
35+
sinon.stub(commonData.ESClient, 'search').callsFake(async () => testData.workPeriodPayment01.workPeriodUpdateESSearchResponse)
3536
const response = await service.createWorkPeriodPayment(commonData.currentUser, testData.workPeriodPayment01.request)
3637
expect(stubGetUserId.calledOnce).to.be.true
3738
expect(stubEnsureWorkPeriodById.calledOnce).to.be.true

test/unit/common/CommonData.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,13 @@ const userWithManagePermission = {
1313
const regularUser = {
1414
userId: '222'
1515
}
16-
const ESClient = {}
16+
const ESClient = {
17+
create: () => {},
18+
update: () => {},
19+
delete: () => {},
20+
search: () => {}
21+
}
22+
1723
module.exports = {
1824
currentUser,
1925
UserTCConnCopilot,

test/unit/common/WorkPeriodPaymentData.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,18 @@ const workPeriodPayment01 = {
118118
paymentStatus: 'in-progress',
119119
updatedAt: '2021-06-13T18:25:08.492Z'
120120
},
121+
workPeriodUpdateESSearchResponse: {
122+
body: {
123+
hits: {
124+
hits: [
125+
{ _id: 'something' }
126+
],
127+
total: {
128+
value: 'something'
129+
}
130+
}
131+
}
132+
},
121133
workPeriodUpdateRequest: {
122134
daysPaid: 5,
123135
paymentTotal: 12.6,

0 commit comments

Comments
 (0)