mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-01-22 19:19:05 +00:00
Test for entities after CollectEvent. (#202)
Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
parent
ed9577b830
commit
1372fc74ef
@ -1022,4 +1022,53 @@ describe('uni-info-watcher', () => {
|
||||
expect(position.liquidity).to.be.equal(expectedLiquidity.toString());
|
||||
});
|
||||
});
|
||||
|
||||
xdescribe('CollectEvent', () => {
|
||||
// Checked entities: Transaction.
|
||||
// Unchecked entities: Position.
|
||||
|
||||
let eventType: string;
|
||||
|
||||
const tokenId = 1;
|
||||
const amount0Max = 15;
|
||||
const amount1Max = 15;
|
||||
|
||||
it('should trigger CollectEvent', async () => {
|
||||
// Position manger collect and wait for BurnEvent.
|
||||
const transaction = nfpm.collect({
|
||||
tokenId,
|
||||
recipient,
|
||||
amount0Max,
|
||||
amount1Max
|
||||
});
|
||||
|
||||
eventType = 'BurnEvent';
|
||||
await Promise.all([
|
||||
transaction,
|
||||
watchEvent(uniClient, eventType)
|
||||
]);
|
||||
|
||||
// Wait for CollectEvent.
|
||||
eventType = 'CollectEvent';
|
||||
await watchEvent(uniClient, eventType);
|
||||
|
||||
// Sleeping for 10 sec for the events to be processed.
|
||||
await wait(10000);
|
||||
});
|
||||
|
||||
it('should create a Transaction entity', async () => {
|
||||
// Checked values: mints, burns, swaps.
|
||||
|
||||
const transaction: any = await fetchTransaction(endpoint);
|
||||
|
||||
const expectedTxTimestamp = transaction.timestamp;
|
||||
|
||||
expect(transaction.mints).to.be.empty;
|
||||
expect(transaction.burns).to.not.be.empty;
|
||||
expect(transaction.swaps).to.be.empty;
|
||||
|
||||
const timestamp = transaction.burns[0].timestamp;
|
||||
expect(timestamp).to.be.equal(expectedTxTimestamp);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -461,7 +461,7 @@ describe('uni-watcher', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Position manger increase liquidity.
|
||||
// Position manger collect.
|
||||
const transaction: ContractTransaction = await nfpm.collect({
|
||||
tokenId,
|
||||
recipient,
|
||||
|
Loading…
Reference in New Issue
Block a user