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

Update the removeSupportAllNFTs method #9017

Merged
merged 2 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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