Skip to content

Commit

Permalink
chore: fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Apr 17, 2024
1 parent a96fc97 commit 2c6aa3f
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 47 deletions.
11 changes: 5 additions & 6 deletions __tests__/hooks/use-display-currency.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,11 @@ const wrapWithMocks =


(mocks) =>
({ children }: PropsWithChildren) =>
(
<IsAuthedContextProvider value={true}>
<MockedProvider mocks={mocks}>{children}</MockedProvider>
</IsAuthedContextProvider>
)
({ children }: PropsWithChildren) => (
<IsAuthedContextProvider value={true}>
<MockedProvider mocks={mocks}>{children}</MockedProvider>
</IsAuthedContextProvider>
)

describe("usePriceConversion", () => {
describe("testing moneyAmountToMajorUnitOrSats", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe("amount lightning payment details", () => {
const paymentDetails = createAmountLightningPaymentDetails(defaultParams)
const senderSpecifiedMemo = "sender memo"
if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set")

const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo)
expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo)
})
Expand All @@ -174,7 +174,9 @@ describe("amount lightning payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
6 changes: 4 additions & 2 deletions __tests__/payment-details/amount-onchain.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("no amount onchain payment details", () => {
const paymentDetails = createAmountOnchainPaymentDetails(defaultParams)
const senderSpecifiedMemo = "sender memo"
if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set")

const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo)
expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo)
})
Expand All @@ -180,7 +180,9 @@ describe("no amount onchain payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
6 changes: 4 additions & 2 deletions __tests__/payment-details/intraledger-payment-details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ describe("intraledger payment details", () => {
const paymentDetails = createIntraledgerPaymentDetails(defaultParams)
const senderSpecifiedMemo = "sender memo"
if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set")

const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo)
expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo)
})
Expand All @@ -168,7 +168,9 @@ describe("intraledger payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
4 changes: 3 additions & 1 deletion __tests__/payment-details/lnurl-payment-details.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ describe("lnurl payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ describe("no amount lightning payment details", () => {
const paymentDetails = createNoAmountLightningPaymentDetails(defaultParams)
const senderSpecifiedMemo = "sender memo"
if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set")

const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo)
expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo)
})
Expand All @@ -215,7 +215,9 @@ describe("no amount lightning payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
6 changes: 4 additions & 2 deletions __tests__/payment-details/no-amount-onchain.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe("no amount lightning payment details", () => {
const paymentDetails = createNoAmountOnchainPaymentDetails(defaultParams)
const senderSpecifiedMemo = "sender memo"
if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set")

const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo)
expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo)
})
Expand All @@ -212,7 +212,9 @@ describe("no amount lightning payment details", () => {
currency: WalletCurrency.Btc,
id: "newtestwallet",
}
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor)
const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(
sendingWalletDescriptor,
)
expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor)
})
})
36 changes: 18 additions & 18 deletions app/components/transaction-item/index.types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ type DeepPartialPrimitive = Primitive | Date | RegExp
export type DeepPartial<T> = T extends DeepPartialPrimitive
? T
: T extends Map<infer TKey, infer TValue>
? DeepPartialMap<TKey, TValue>
: T extends ReadonlyMap<infer TKey, infer TValue>
? DeepPartialReadonlyMap<TKey, TValue>
: T extends Set<infer TItem>
? DeepPartialSet<TItem>
: T extends ReadonlySet<infer TItem>
? DeepPartialReadonlySet<TItem>
: T extends (...args: unknown[]) => unknown
? T | undefined
: T extends object
? T extends ReadonlyArray<infer TItem>
? TItem[] extends T
? readonly TItem[] extends T
? ReadonlyArray<DeepPartial<TItem | undefined>>
: Array<DeepPartial<TItem | undefined>>
: DeepPartialObject<T>
: DeepPartialObject<T>
: unknown
? DeepPartialMap<TKey, TValue>
: T extends ReadonlyMap<infer TKey, infer TValue>
? DeepPartialReadonlyMap<TKey, TValue>
: T extends Set<infer TItem>
? DeepPartialSet<TItem>
: T extends ReadonlySet<infer TItem>
? DeepPartialReadonlySet<TItem>
: T extends (...args: unknown[]) => unknown
? T | undefined
: T extends object
? T extends ReadonlyArray<infer TItem>
? TItem[] extends T
? readonly TItem[] extends T
? ReadonlyArray<DeepPartial<TItem | undefined>>
: Array<DeepPartial<TItem | undefined>>
: DeepPartialObject<T>
: DeepPartialObject<T>
: unknown
export type DeepPartialObject<T extends object> = {
[K in keyof T]?: DeepPartial<T[K]>
}
4 changes: 2 additions & 2 deletions app/components/transaction-item/transaction-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const TransactionItem: React.FC<Props> = ({
const amountStyle = isPending
? styles.pending
: isReceive
? styles.receive
: styles.send
? styles.receive
: styles.send

const walletCurrency = tx.settlementCurrency as WalletCurrency

Expand Down
11 changes: 7 additions & 4 deletions app/hooks/use-display-currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,13 @@ export const useDisplayCurrency = () => {

const displayCurrencyDictionary = useMemo(() => {
const currencyList = dataCurrencyList?.currencyList || []
return currencyList.reduce((acc, currency) => {
acc[currency.id] = currency
return acc
}, {} as Record<string, typeof defaultDisplayCurrency>)
return currencyList.reduce(
(acc, currency) => {
acc[currency.id] = currency
return acc
},
{} as Record<string, typeof defaultDisplayCurrency>,
)
}, [dataCurrencyList?.currencyList])

const displayCurrencyInfo =
Expand Down
4 changes: 2 additions & 2 deletions app/screens/earns-screen/earns-quiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ export const EarnQuiz = ({ route }: Props) => {
return recordedAnswer.indexOf(i) === -1
? styles.quizButtonStyle
: i === 0
? styles.quizCorrectButtonStyle
: styles.quizWrongButtonStyle
? styles.quizCorrectButtonStyle
: styles.quizWrongButtonStyle
}

let j: ZeroTo2 = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ const SendBitcoinConfirmationScreen: React.FC<Props> = ({ route }) => {
{hideAmount
? "****"
: sendingWalletDescriptor.currency === WalletCurrency.Btc
? btcWalletText
: usdWalletText}
? btcWalletText
: usdWalletText}
</Text>
</View>
<View />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ const SendBitcoinDetailsScreen: React.FC<Props> = ({ route }) => {
{hideAmount
? "****"
: sendingWalletDescriptor.currency === WalletCurrency.Btc
? btcWalletText
: usdWalletText}
? btcWalletText
: usdWalletText}
</Text>
</View>
</View>
Expand Down

0 comments on commit 2c6aa3f

Please sign in to comment.