1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Force update mock state and render nfts item test fix (#18044)

This commit is contained in:
Thomas Huang 2023-03-09 08:36:12 -08:00 committed by GitHub
parent 1121e3a848
commit 766c8a3e53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,7 @@ describe('NFTs Item Component', () => {
const mockStore = configureMockStore([thunk])(mockState);
it('should expand NFT collection showing individual NFTs', async () => {
const { queryByTestId, queryAllByTestId, rerender } = renderWithProvider(
const { queryByTestId, queryAllByTestId } = renderWithProvider(
<NftsItems {...props} />,
mockStore,
);
@ -54,16 +54,20 @@ describe('NFTs Item Component', () => {
fireEvent.click(collectionExpanderButton);
expect(updateNftDropDownState).toHaveBeenCalledWith({
const expectedParams = {
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': {
'0x5': {
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': true,
'0x495f947276749Ce646f68AC8c248420045cb7b5e': false,
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': true,
},
},
});
};
rerender(<NftsItems {...props} />, mockStore);
expect(updateNftDropDownState).toHaveBeenCalledWith(expectedParams);
// Force rerender component with state/store update
mockState.metamask.nftsDropdownState = expectedParams;
renderWithProvider(<NftsItems {...props} />, mockStore);
expect(queryAllByTestId('nft-wrapper')).toHaveLength(8);
});