-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Alissa Crane <[email protected]>
- Loading branch information
1 parent
195c1c0
commit fd8a462
Showing
5 changed files
with
107 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Kit Test | ||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
branches: ['main'] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Template Install dependencies | ||
run: bun install | ||
|
||
- name: Kit Test | ||
# When fails, please check your tests | ||
run: bun run test:coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { http, WagmiProvider, createConfig } from 'wagmi'; | ||
import { base } from 'wagmi/chains'; | ||
import { mock } from 'wagmi/connectors'; | ||
import TransactionWrapper from './TransactionWrapper'; | ||
|
||
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(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,42 @@ | ||
import { render } from '@testing-library/react'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { http, WagmiProvider, createConfig } from 'wagmi'; | ||
import { base } from 'wagmi/chains'; | ||
import { mock } from 'wagmi/connectors'; | ||
import WalletWrapper from './WalletWrapper'; | ||
|
||
const config = createConfig({ | ||
chains: [base], | ||
connectors: [ | ||
mock({ | ||
accounts: [ | ||
'0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', | ||
'0x70997970c51812dc3a010c7d01b50e0d17dc79c8', | ||
'0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC', | ||
], | ||
}), | ||
], | ||
transports: { | ||
[base.id]: http(), | ||
}, | ||
}); | ||
const queryClient = new QueryClient(); | ||
|
||
const renderWithProviders = (Component: React.ComponentType) => { | ||
return render( | ||
<WagmiProvider config={config}> | ||
<QueryClientProvider client={queryClient}> | ||
<Component /> | ||
</QueryClientProvider> | ||
</WagmiProvider>, | ||
); | ||
}; | ||
|
||
describe('WalletWrapper', () => { | ||
it('should renders', () => { | ||
render(<WalletWrapper />); | ||
expect(true).toBeTruthy(); | ||
renderWithProviders(WalletWrapper); | ||
const wallet = screen.getByTestId('ockConnectWallet_Container'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Themoor1
|
||
expect(wallet).toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
304402206883f9de55547576ffa1af1e87d20b8c94d073a8c45be6082996b8faa7e2ce4102207dc3193f1bba20d929a20cc77df3269e1cc60e1fab36a705ba0866cb27d99cb801