-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated txn success handler to pass multiple receipts for multi…
…ple contracts (EOA) (#945) Co-authored-by: Alissa Crane <[email protected]>
- Loading branch information
1 parent
baa0781
commit bfea1bf
Showing
9 changed files
with
174 additions
and
25 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
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 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import { describe, it, vi } from 'vitest'; | ||
import { Swap } from './Swap'; | ||
|
||
vi.mock('./SwapProvider', () => ({ | ||
SwapProvider: ({ children }) => ( | ||
<div data-testid="mock-SwapProvider">{children}</div> | ||
), | ||
useSwapContext: vi.fn(), | ||
})); | ||
|
||
describe('Swap Component', () => { | ||
it('should render the title correctly', () => { | ||
render(<Swap title="Test Swap" />); | ||
|
||
const title = screen.getByTestId('ockSwap_Title'); | ||
expect(title).toHaveTextContent('Test Swap'); | ||
}); | ||
|
||
it('should pass className to container div', () => { | ||
render(<Swap className="custom-class" />); | ||
|
||
const container = screen.getByTestId('ockSwap_Container'); | ||
expect(container).toHaveClass('custom-class'); | ||
}); | ||
}); |
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,31 @@ | ||
import { fireEvent, render, screen } from '@testing-library/react'; | ||
import { describe, it, vi } from 'vitest'; | ||
import { useSwapContext } from './SwapProvider'; | ||
import { SwapToggleButton } from './SwapToggleButton'; | ||
|
||
vi.mock('./SwapProvider', () => ({ | ||
useSwapContext: vi.fn(), | ||
})); | ||
|
||
describe('SwapToggleButton', () => { | ||
it('should call handleToggle when clicked', () => { | ||
const handleToggleMock = vi.fn(); | ||
(useSwapContext as jest.Mock).mockReturnValue({ | ||
handleToggle: handleToggleMock, | ||
}); | ||
|
||
render(<SwapToggleButton />); | ||
|
||
const button = screen.getByTestId('SwapTokensButton'); | ||
fireEvent.click(button); | ||
|
||
expect(handleToggleMock).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should render with correct classes', () => { | ||
render(<SwapToggleButton className="custom-class" />); | ||
|
||
const button = screen.getByTestId('SwapTokensButton'); | ||
expect(button).toHaveClass('custom-class'); | ||
}); | ||
}); |
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
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
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