-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testnet banner in minifront and prax (#1013)
- Loading branch information
1 parent
d03bb8c
commit 926dc12
Showing
6 changed files
with
52 additions
and
11 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
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,24 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { render } from '@testing-library/react'; | ||
import { TestnetBanner } from './testnet-banner'; | ||
|
||
describe('<TestnetBanner />', () => { | ||
it('renders banner if chainId is a testnet', () => { | ||
const { container } = render(<TestnetBanner chainId='penumbra-testnet-deimos-7' />); | ||
|
||
expect(container).toHaveTextContent('penumbra-testnet-deimos-7'); | ||
expect(container).toHaveTextContent('Testnet tokens have no monetary value.'); | ||
}); | ||
|
||
it('does not render banner if chainId is not a testnet', () => { | ||
const { container } = render(<TestnetBanner chainId='any-other-name' />); | ||
expect(container).not.toHaveTextContent('any-other-name'); | ||
expect(container).not.toHaveTextContent('Testnet tokens have no monetary value.'); | ||
}); | ||
|
||
it('does not render banner if chainId is missing', () => { | ||
const { container } = render(<TestnetBanner chainId={undefined} />); | ||
expect(container).not.toHaveTextContent('any-other-name'); | ||
expect(container).not.toHaveTextContent('Testnet tokens have no monetary value.'); | ||
}); | ||
}); |
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,12 @@ | ||
export const TestnetBanner = ({ chainId }: { chainId?: string }) => | ||
chainId?.includes('testnet') && ( | ||
<div className='w-full bg-yellow-500 text-center font-headline text-black'> | ||
<div className='m-auto max-w-prose p-2'> | ||
<h1 className='font-bold'>You are using {chainId}.</h1> | ||
<p> | ||
Testnet tokens are solely to allow testing the Penumbra protocol. Testnet tokens have no | ||
monetary value. Testnet activity has no relation to mainnet. | ||
</p> | ||
</div> | ||
</div> | ||
); |