Skip to content

Commit

Permalink
fix: wait more blocks in ethereum events tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vklachkov committed Jan 15, 2025
1 parent 16586d0 commit 9c8ab25
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions js-packages/tests/eth/events.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function testCollectionCreatedAndDestroy(helper: EthUniqueHelper, mode: TC
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionCreated', 'CollectionDestroyed']}]);
const {collectionAddress, events: ethEvents} = await helper.eth.createCollection(owner, new CreateCollectionData('A', 'B', 'C', mode, 18)).send();

await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
{
expect(ethEvents).to.containSubset([
{
Expand All @@ -60,7 +60,7 @@ async function testCollectionCreatedAndDestroy(helper: EthUniqueHelper, mode: TC
{
const collectionHelper = await helper.ethNativeContract.collectionHelpers(owner);
const result = await collectionHelper.methods.destroyCollection(collectionAddress).send({from:owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(result.events).to.containSubset({
CollectionDestroyed: {
returnValues: {
Expand All @@ -86,7 +86,7 @@ async function testCollectionPropertySetAndDeleted(helper: EthUniqueHelper, mode
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionPropertySet', 'CollectionPropertyDeleted']}]);
{
await collection.methods.setCollectionProperties([{key: 'A', value: [0,1,2,3]}]).send({from:owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -100,7 +100,7 @@ async function testCollectionPropertySetAndDeleted(helper: EthUniqueHelper, mode
}
{
await collection.methods.deleteCollectionProperties(['A']).send({from:owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand Down Expand Up @@ -131,7 +131,7 @@ async function testPropertyPermissionSet(helper: EthUniqueHelper, mode: TCollect
[TokenPermissionField.CollectionAdmin, true]],
],
]).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -158,7 +158,7 @@ async function testAllowListAddressAddedAndRemoved(helper: EthUniqueHelper, mode
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['AllowListAddressAdded', 'AllowListAddressRemoved']}]);
{
await collection.methods.addToCollectionAllowListCross(user).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -172,7 +172,7 @@ async function testAllowListAddressAddedAndRemoved(helper: EthUniqueHelper, mode
}
{
await collection.methods.removeFromCollectionAllowListCross(user).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -199,7 +199,7 @@ async function testCollectionAdminAddedAndRemoved(helper: EthUniqueHelper, mode:
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionAdminAdded', 'CollectionAdminRemoved']}]);
{
await collection.methods.addCollectionAdminCross(user).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -213,7 +213,7 @@ async function testCollectionAdminAddedAndRemoved(helper: EthUniqueHelper, mode:
}
{
await collection.methods.removeCollectionAdminCross(user).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -239,7 +239,7 @@ async function testCollectionLimitSet(helper: EthUniqueHelper, mode: TCollection
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionLimitSet']}]);
{
await collection.methods.setCollectionLimit({field: CollectionLimitField.OwnerCanTransfer, value: {status: true, value: 0}}).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -266,7 +266,7 @@ async function testCollectionOwnerChanged(helper: EthUniqueHelper, mode: TCollec
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionOwnerChanged']}]);
{
await collection.methods.changeCollectionOwnerCross(newOwner).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -292,7 +292,7 @@ async function testCollectionPermissionSet(helper: EthUniqueHelper, mode: TColle
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['CollectionPermissionSet']}]);
{
await collection.methods.setCollectionMintMode(true).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -306,7 +306,7 @@ async function testCollectionPermissionSet(helper: EthUniqueHelper, mode: TColle
}
{
await collection.methods.setCollectionAccess(1).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand Down Expand Up @@ -335,7 +335,7 @@ async function testCollectionSponsorSetAndConfirmedAndThenRemoved(helper: EthUni
]}]);
{
await collection.methods.setCollectionSponsorCross(sponsor).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([{
event: 'CollectionChanged',
returnValues: {
Expand All @@ -347,7 +347,7 @@ async function testCollectionSponsorSetAndConfirmedAndThenRemoved(helper: EthUni
}
{
await collection.methods.confirmCollectionSponsorship().send({from: sponsor.eth});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand All @@ -361,7 +361,7 @@ async function testCollectionSponsorSetAndConfirmedAndThenRemoved(helper: EthUni
}
{
await collection.methods.removeCollectionSponsor().send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(ethEvents).to.containSubset([
{
event: 'CollectionChanged',
Expand Down Expand Up @@ -392,7 +392,7 @@ async function testTokenPropertySetAndDeleted(helper: EthUniqueHelper, mode: TCo
const {unsubscribe, collectedEvents: subEvents} = await helper.subscribeEvents([{section: 'common', names: ['TokenPropertySet', 'TokenPropertyDeleted']}]);
{
const result = await collection.methods.setProperties(tokenId, [{key: 'A', value: [1,2,3]}]).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(result.events.TokenChanged).to.be.like({
event: 'TokenChanged',
returnValues: {
Expand All @@ -404,7 +404,7 @@ async function testTokenPropertySetAndDeleted(helper: EthUniqueHelper, mode: TCo
}
{
const result = await collection.methods.deleteProperties(tokenId, ['A']).send({from: owner});
await helper.wait.newBlocks(1);
await helper.wait.newBlocks(10);
expect(result.events.TokenChanged).to.be.like({
event: 'TokenChanged',
returnValues: {
Expand Down

0 comments on commit 9c8ab25

Please sign in to comment.