-
Notifications
You must be signed in to change notification settings - Fork 464
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* init * feat: Add remove delegate option and adjust delegate list layout (#4390) * feat: Add remove delegate button, adjust delegate list layout * feat: Update gateway-sdk package, add delegate form * feat: Optimistically update delegates cache when adding or removing delegate * fix: Add missing ga events, add enum * chore: Update gateway-sdk package * fix: Update setup settings layout * fix: Add notifications when adding and removing proposer * fix: Add validation for add proposer * fix: Rename delegate to proposer * fix: Rename variable for add proposer dialog * fix: Align remove icons in tables * fix: Handle update proposer in rtk query * feat: Show Proposal chip for unsigned transactions in the queue (#4422) * feat: Allow deletion of delegate transactions from the queue [SW-297] (#4400) * init * feat: Allow deletion of delegate transactions from the queue * feat: Add text to signer view if tx is from proposer * fix: Disable add proposer and delete proposer [SW-400] [SW-396] (#4429) * fix: Disable add proposer and delete proposer * fix: Account for owners that are proposers in CheckWallet * fix: Adjust message when proposing transaction (#4435) * feat: Edit proposer dialog [SW-391] [SW-396] (#4436) * feat: Show proposer address in queue (#4443) * fix: Hide tooltip on confirm button for proposers (#4444) * fix: Use safe owner address for tenderly simulation with proposer (#4445) * fix: Only show proposal chip if transaction is not pending (#4450) * fix: Allow owners to be added as proposers [SW-407] [SW-428] [SW-381] (#4446) * fix: Remove scrollbar when adding proposer * fix: Allow owners being added as proposers * fix: Add check that isProposing only when its also a creation * fix: Update testid to fix add owner smoke test * fix: Hide batch button for proposers (#4457) * feat: Support hardware wallets for adding and removing proposers (#4466) * feat: Display creator in the proposer list [SW-408] [SW-470] (#4471) * feat: Display creator in proposer list * fix: Correctly update proposers when editing and deleting * fix: Remove dangling console.log * fix: Add network switch to delete proposer dialog and reset values when closing * fix: AdjustVInSignature when managing proposers with a hardware wallet (#4477) * fix: Add proposers feature flag (#4488)
- Loading branch information
1 parent
d90cbfa
commit 50e44fe
Showing
42 changed files
with
1,211 additions
and
209 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 |
---|---|---|
|
@@ -16,5 +16,4 @@ | |
|
||
.readOnly :global .MuiInputBase-input { | ||
visibility: hidden; | ||
position: absolute; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
import Header from '@/components/common/Header/index' | ||
import * as useChains from '@/hooks/useChains' | ||
import * as useIsSafeOwner from '@/hooks/useIsSafeOwner' | ||
import * as useProposers from '@/hooks/useProposers' | ||
import * as useSafeAddress from '@/hooks/useSafeAddress' | ||
import * as useSafeTokenEnabled from '@/hooks/useSafeTokenEnabled' | ||
import { render } from '@/tests/test-utils' | ||
import { faker } from '@faker-js/faker' | ||
import { screen, fireEvent } from '@testing-library/react' | ||
|
||
jest.mock( | ||
'@/components/common/SafeTokenWidget', | ||
() => | ||
function SafeTokenWidget() { | ||
return <div>SafeTokenWidget</div> | ||
}, | ||
) | ||
|
||
jest.mock( | ||
'@/features/walletconnect/components', | ||
() => | ||
function WalletConnect() { | ||
return <div>WalletConnect</div> | ||
}, | ||
) | ||
|
||
jest.mock( | ||
'@/components/common/NetworkSelector', | ||
() => | ||
function NetworkSelector() { | ||
return <div>NetworkSelector</div> | ||
}, | ||
) | ||
|
||
describe('Header', () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks() | ||
}) | ||
|
||
it('renders the menu button when onMenuToggle is provided', () => { | ||
render(<Header onMenuToggle={jest.fn()} />) | ||
expect(screen.getByLabelText('menu')).toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the menu button when onMenuToggle is not provided', () => { | ||
render(<Header />) | ||
expect(screen.queryByLabelText('menu')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('calls onMenuToggle when menu button is clicked', () => { | ||
const onMenuToggle = jest.fn() | ||
render(<Header onMenuToggle={onMenuToggle} />) | ||
|
||
const menuButton = screen.getByLabelText('menu') | ||
fireEvent.click(menuButton) | ||
|
||
expect(onMenuToggle).toHaveBeenCalled() | ||
}) | ||
|
||
it('renders the SafeTokenWidget when showSafeToken is true', () => { | ||
jest.spyOn(useSafeTokenEnabled, 'useSafeTokenEnabled').mockReturnValue(true) | ||
|
||
render(<Header />) | ||
expect(screen.getByText('SafeTokenWidget')).toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the SafeTokenWidget when showSafeToken is false', () => { | ||
jest.spyOn(useSafeTokenEnabled, 'useSafeTokenEnabled').mockReturnValue(false) | ||
|
||
render(<Header />) | ||
expect(screen.queryByText('SafeTokenWidget')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('displays the safe logo', () => { | ||
render(<Header />) | ||
expect(screen.getAllByAltText('Safe logo')[0]).toBeInTheDocument() | ||
}) | ||
|
||
it('renders the BatchIndicator when showBatchButton is true', () => { | ||
jest.spyOn(useSafeAddress, 'default').mockReturnValue(faker.finance.ethereumAddress()) | ||
jest.spyOn(useProposers, 'useIsWalletProposer').mockReturnValue(false) | ||
jest.spyOn(useIsSafeOwner, 'default').mockReturnValue(false) | ||
|
||
render(<Header />) | ||
expect(screen.getByTitle('Batch')).toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the BatchIndicator when there is no safe address', () => { | ||
jest.spyOn(useSafeAddress, 'default').mockReturnValue('') | ||
|
||
render(<Header />) | ||
expect(screen.queryByTitle('Batch')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the BatchIndicator when connected wallet is a proposer', () => { | ||
jest.spyOn(useProposers, 'useIsWalletProposer').mockReturnValue(true) | ||
|
||
render(<Header />) | ||
expect(screen.queryByTitle('Batch')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('renders the WalletConnect component when enableWc is true', () => { | ||
jest.spyOn(useChains, 'useHasFeature').mockReturnValue(true) | ||
|
||
render(<Header />) | ||
expect(screen.getByText('WalletConnect')).toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the WalletConnect component when enableWc is false', () => { | ||
jest.spyOn(useChains, 'useHasFeature').mockReturnValue(false) | ||
|
||
render(<Header />) | ||
expect(screen.queryByText('WalletConnect')).not.toBeInTheDocument() | ||
}) | ||
|
||
it('renders the NetworkSelector when safeAddress exists', () => { | ||
jest.spyOn(useSafeAddress, 'default').mockReturnValue(faker.finance.ethereumAddress()) | ||
|
||
render(<Header />) | ||
expect(screen.getByText('NetworkSelector')).toBeInTheDocument() | ||
}) | ||
|
||
it('does not render the NetworkSelector when safeAddress is falsy', () => { | ||
jest.spyOn(useSafeAddress, 'default').mockReturnValue('') | ||
|
||
render(<Header />) | ||
expect(screen.queryByText('NetworkSelector')).not.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 was deleted.
Oops, something went wrong.
Oops, something went wrong.