Skip to content

Commit

Permalink
Added event Payment emit in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Quentin D.C <[email protected]>
  • Loading branch information
quent043 committed Nov 24, 2023
1 parent b4fdc63 commit 10dc721
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion test/batch/fullWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
expiredProposalDate,
proposalExpirationDate,
ServiceStatus,
PaymentType,
} from '../utils/constant'
import { getSignatureForProposal, getSignatureForService } from '../utils/signature'

Expand Down Expand Up @@ -1405,6 +1406,17 @@ describe('TalentLayer protocol global testing', function () {
[-releasedAmount, 0, releasedAmount],
)

await expect(tx)
.to.emit(talentLayerEscrow, 'Payment')
.withArgs(
transactionId,
PaymentType.Release,
token.address,
releasedAmount,
serviceId,
transactionDetailsBefore.proposalId,
)

// Check transaction data has been updated correctly
const transactionDetailsAfter = await talentLayerEscrow
.connect(alice)
Expand Down Expand Up @@ -1535,7 +1547,7 @@ describe('TalentLayer protocol global testing', function () {

await token.connect(alice).approve(talentLayerEscrow.address, totalAmount)

// we need to retreive the Bob proposal dataUri
// we need to retrieve the Bob proposal dataUri
const proposal = await talentLayerService.proposals(serviceId, bobTlId)

await expect(
Expand Down Expand Up @@ -1577,6 +1589,16 @@ describe('TalentLayer protocol global testing', function () {
[talentLayerEscrow.address, alice, bob],
[-totalAmount / 4, totalAmount / 4, 0],
)
await expect(transaction)
.to.emit(talentLayerEscrow, 'Payment')
.withArgs(
transactionId,
PaymentType.Reimburse,
token.address,
totalAmount / 4,
serviceId,
transactionDetailsBefore.proposalId,
)
await expect(transaction).to.emit(talentLayerEscrow, 'PaymentCompleted').withArgs(serviceId)

// Check transaction data has been updated correctly
Expand Down

0 comments on commit 10dc721

Please sign in to comment.