-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix qr icon. Fixes #84 * update coin selection modal. Fixes #85 * 0.0.5-alpha * update adaptive-icon, remove unused assets * add basic styling test for addressbook & coin selection modal usage * add some basic tests for the coin selection modal component
- Loading branch information
Showing
16 changed files
with
108 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,78 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
import { CoinSelectionModal } from '@screens/Lightning/modal' | ||
import { l } from '@src/logger' | ||
import { render, screen } from '@testing-library/react-native' | ||
|
||
describe('Basic styling test of the CoinSelectionModal component', () => { | ||
it('has a specific style applied', () => { | ||
render( | ||
<CoinSelectionModal | ||
lnAmount={1} | ||
disableCS={() => l('test coin selection modal')} | ||
proofs={[]} | ||
setProof={() => l('proofs')} | ||
/> | ||
) | ||
const modal = screen.getByTestId('testCoinSelectionModal') | ||
expect(modal.props.children.props.children.props.style[0].paddingHorizontal).toBe(0) | ||
}) | ||
it('hides the confirm button if not enough proofs are selected', () => { | ||
render( | ||
<CoinSelectionModal | ||
lnAmount={10} | ||
disableCS={() => l('test coin selection modal')} | ||
proofs={[ | ||
{ selected: false, amount: 4, secret: '', C: '', id: '0' }, | ||
{ selected: false, amount: 8, secret: '', C: '', id: '1' }, | ||
]} | ||
setProof={() => l('proofs')} | ||
/> | ||
) | ||
expect(screen.queryByText('Confirm')).toBeNull() | ||
}) | ||
it('should display the confirm button if enough proofs are selected', () => { | ||
render( | ||
<CoinSelectionModal | ||
lnAmount={10} | ||
disableCS={() => l('test coin selection modal')} | ||
proofs={[ | ||
{ selected: true, amount: 4, secret: '', C: '', id: '0' }, | ||
{ selected: true, amount: 8, secret: '', C: '', id: '1' }, | ||
]} | ||
setProof={() => l('proofs')} | ||
/> | ||
) | ||
expect(screen.getByText('Confirm')).toBeDefined() | ||
}) | ||
it('should display the change after selecting more proofs than needed', () => { | ||
render( | ||
<CoinSelectionModal | ||
lnAmount={10} | ||
disableCS={() => l('test coin selection modal')} | ||
proofs={[ | ||
{ selected: true, amount: 4, secret: '', C: '', id: '0' }, | ||
{ selected: true, amount: 8, secret: '', C: '', id: '1' }, | ||
]} | ||
setProof={() => l('proofs')} | ||
/> | ||
) | ||
expect(screen.getByText('Change')).toBeDefined() | ||
expect(screen.getByText('2 Sat')).toBeDefined() | ||
}) | ||
it('should not display the change after selecting the exact proofs needed', () => { | ||
render( | ||
<CoinSelectionModal | ||
lnAmount={10} | ||
disableCS={() => l('test coin selection modal')} | ||
proofs={[ | ||
{ selected: true, amount: 4, secret: '', C: '', id: '0' }, | ||
{ selected: true, amount: 4, secret: '', C: '', id: '1' }, | ||
{ selected: true, amount: 2, secret: '', C: '', id: '2' }, | ||
]} | ||
setProof={() => l('proofs')} | ||
/> | ||
) | ||
expect(screen.queryByText('Change')).toBeNull() | ||
}) | ||
}) |