Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Update the removeSupportAllNFTs method (#9017)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosmartin authored Sep 21, 2023
1 parent cf5c582 commit 22213a7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions framework/src/modules/nft/method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,8 @@ export class NFTMethod extends BaseMethod {
await supportedNFTsStore.del(methodContext, key);
}

await supportedNFTsStore.del(methodContext, ALL_SUPPORTED_NFTS_KEY);

this.events.get(AllNFTsSupportRemovedEvent).log(methodContext);
}

Expand Down
14 changes: 14 additions & 0 deletions framework/test/unit/modules/nft/method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1189,6 +1189,20 @@ describe('NFTMethod', () => {

checkEventResult(methodContext.eventQueue, 1, AllNFTsSupportRemovedEvent, 0, {}, null);
});

it('should remove all existing entries even if the ALL_SUPPORTED_NFTS_KEY entry exists', async () => {
await supportedNFTsStore.save(methodContext, ALL_SUPPORTED_NFTS_KEY, {
supportedCollectionIDArray: [],
});

await expect(method.removeSupportAllNFTs(methodContext)).resolves.toBeUndefined();
await expect(
supportedNFTsStore.has(methodContext, ALL_SUPPORTED_NFTS_KEY),
).resolves.toBeFalse();

checkEventResult(methodContext.eventQueue, 1, AllNFTsSupportRemovedEvent, 0, {}, null);
expect(methodContext.eventQueue.getEvents()).toHaveLength(1);
});
});

describe('supportAllNFTsFromChain', () => {
Expand Down

0 comments on commit 22213a7

Please sign in to comment.