Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.5 alpha #86

Merged
merged 6 commits into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/appName.png
Binary file not shown.
Binary file removed assets/appName_dark.png
Binary file not shown.
Binary file removed assets/icon.png
Binary file not shown.
Binary file removed assets/icon_transparent_dark.png
Binary file not shown.
Binary file removed assets/logo_transparent.png
Binary file not shown.
File renamed without changes
2 changes: 1 addition & 1 deletion config/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const config: ExpoConfig = {
version: `${version}${!IS_PROD ? `-${_appVariant}` : ''}`,
scheme: 'cashu',
orientation: 'portrait',
icon: './assets/icon.png',
icon: './assets/icon_transparent.png',
userInterfaceStyle: 'light',
splash: {
image: './assets/splash.png',
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"blind-signatures",
"lightning-network"
],
"version": "0.0.4-alpha",
"version": "0.0.5-alpha",
"license": "AGPL-3.0-only",
"bugs": {
"url": "https://github.com/cashubtc/eNuts/issues"
Expand Down
2 changes: 1 addition & 1 deletion src/components/QR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function QR({ size, value, onError }: QRProps) {
size={size}
value={value}
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
logo={require('../../assets/adaptive-icon.png')}
logo={require('../../assets/qr-icon.png')}
logoBorderRadius={10}
logoBackgroundColor='#fafafa'
logoMargin={3}
Expand Down
7 changes: 4 additions & 3 deletions src/components/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface IMyModalProps {
animation?: 'slide' | 'fade' | 'none'
visible: boolean
success?: boolean
isContactList?: boolean
hasNoPadding?: boolean
close?: () => void
children: React.ReactNode
}
Expand All @@ -19,7 +19,7 @@ export default function MyModal({
animation,
visible,
success,
isContactList,
hasNoPadding,
close,
children
}: IMyModalProps) {
Expand All @@ -43,7 +43,7 @@ export default function MyModal({
...styles(color, highlight).common,
...styles(color, highlight).invoiceAmountModalView,
}
if (isContactList) {
if (hasNoPadding) {
styling = { ...styling, ...styles(color, highlight).contactList }
}
return styling
Expand All @@ -58,6 +58,7 @@ export default function MyModal({
transparent
animationType={animation}
onRequestClose={close}
testID='testCoinSelectionModal'
>
<KeyboardAvoidingView
style={getCorrectStyle()}
Expand Down
8 changes: 7 additions & 1 deletion src/components/screens/Addressbook/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ interface IAddressBookModalProps {

export default function AddressbookModal({ closeModal, setInput }: IAddressBookModalProps) {
return (
<MyModal type='invoiceAmount' animation='slide' visible isContactList close={closeModal}>
<MyModal
type='invoiceAmount'
animation='slide'
visible
hasNoPadding
close={closeModal}
>
<AddressBook
isModal
closeModal={closeModal}
Expand Down
2 changes: 1 addition & 1 deletion src/components/screens/Lightning/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export function CoinSelectionModal({ mint, lnAmount, disableCS, proofs, setProof
})()
}, [mint?.mintUrl])
return (
<MyModal type='invoiceAmount' animation='slide' visible={visible} close={cancelCoinSelection}>
<MyModal type='invoiceAmount' animation='slide' visible={visible} close={cancelCoinSelection} hasNoPadding>
<View style={styles.proofContainer}>
<View style={styles.header}>
<Text style={globals(color).navTxt}>
Expand Down
13 changes: 13 additions & 0 deletions test/components/AddressBook.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import AddressBook from '@comps/screens/Addressbook/Book'
import AddressbookModal from '@comps/screens/Addressbook/modal'
import { l } from '@src/logger'
import { act, fireEvent, render, screen } from '@testing-library/react-native'

jest.useFakeTimers()
Expand Down Expand Up @@ -40,6 +43,16 @@ describe('Test the Addressbook page', () => {
fireEvent.press(screen.getByTestId('addPersonal'))
expect(screen.queryByPlaceholderText('Name')).toBeNull()
})
it('Addressbook modal has a specific style applied', () => {
render(
<AddressbookModal
closeModal={() => l('test')}
setInput={() => l('test')}
/>
)
const modal = screen.getByTestId('testCoinSelectionModal')
expect(modal.props.children.props.children.props.style[0].paddingHorizontal).toBe(0)
})
// TODO test the functionality of adding a new contact and rendering it
// eslint-disable-next-line jest/no-commented-out-tests
// it('Render the new contact', async () => {
Expand Down
78 changes: 78 additions & 0 deletions test/components/CoinSelectionModal.test.tsx
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()
})
})