Skip to content

Commit 47d3421

Browse files
committed
test(Linguo): added regression test
Added regression test for Linguo contract to ensure task price and required deposit are correctly calculated when the task status is not `created`
1 parent 0e27cc7 commit 47d3421

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

test/linguo.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,31 @@ contract('Linguo', function(accounts) {
209209
assert.equal(
210210
depositLinguo.toNumber(),
211211
deposit,
212-
'Contract returns incorrect required deposit afer submission timeout ended'
212+
'Contract returns incorrect required deposit after submission timeout ended'
213+
)
214+
})
215+
216+
it('Should return correct task price and assignment deposit when status is not `created`', async () => {
217+
const requiredDeposit = (await linguo.getDepositValue(0)).toNumber()
218+
await linguo.assignTask(0, {
219+
from: translator,
220+
value: requiredDeposit + 1e17
221+
})
222+
223+
const expectedTaskPrice = 0
224+
const actualTaskPrice = await linguo.getTaskPrice(0)
225+
assert.equal(
226+
actualTaskPrice,
227+
expectedTaskPrice,
228+
'Contract returns incorrect task price if status is not `created`'
229+
)
230+
231+
const expectedDeposit = NOT_PAYABLE_VALUE
232+
const actualDeposit = await linguo.getDepositValue(0)
233+
assert.equal(
234+
actualDeposit.toNumber(),
235+
expectedDeposit,
236+
'Contract returns incorrect required deposit if status is not `created`'
213237
)
214238
})
215239

0 commit comments

Comments
 (0)