Skip to content

Commit

Permalink
add transaction wrapper test
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Aug 8, 2024
1 parent 368a8d9 commit 2ef7f2c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
42 changes: 42 additions & 0 deletions src/components/TransactionWrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { render, screen } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import TransactionWrapper from './TransactionWrapper';
import { http, WagmiProvider, createConfig } from 'wagmi';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { base } from 'wagmi/chains';
import { mock } from 'wagmi/connectors';

const config = createConfig({
chains: [base],
connectors: [
mock({
accounts: [
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC',
],
}),
],
transports: {
[base.id]: http(),
},
});
const queryClient = new QueryClient();

const renderWithProviders = (component: JSX.Element) => {
return render(
<WagmiProvider config={config}>
<QueryClientProvider client={queryClient}>
{component}
</QueryClientProvider>
</WagmiProvider>,
);
};

describe('TransactionWrapper', () => {
it('should renders', () => {
renderWithProviders(<TransactionWrapper address='0x' />);
const transaction = screen.getByText('Collect');
expect(transaction).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion src/components/TransactionWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
mintReferral,
quantity,
tokenId,
} from 'src/constants';
} from '../constants';
import type { Address, ContractFunctionParameters } from 'viem';
import { parseEther } from 'viem';

Expand Down

0 comments on commit 2ef7f2c

Please sign in to comment.