Skip to content

Commit

Permalink
(PC-33482) feat(NC): change after review
Browse files Browse the repository at this point in the history
  • Loading branch information
lbeneston-pass committed Dec 27, 2024
1 parent a418427 commit 62f2aa2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/features/search/pages/modals/PriceModal/PriceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { priceSchema } from 'features/search/helpers/schema/priceSchema/priceSch
import { SearchState } from 'features/search/types'
import { useGetPacificFrancToEuroRate } from 'libs/firebase/firestore/exchangeRates/useGetPacificFrancToEuroRate'
import { formatCurrencyFromCents } from 'libs/parsers/formatCurrencyFromCents'
import { formatCurrencyFromCentsWithoutCurrenySymbol } from 'libs/parsers/formatCurrencyFromCentsWithoutCurrenySymbol'
import { formatCurrencyFromCentsWithoutCurrencySymbol } from 'libs/parsers/formatCurrencyFromCentsWithoutCurrencySymbol'
import { Currency, useGetCurrencyToDisplay } from 'shared/currency/useGetCurrencyToDisplay'
import { useAvailableCredit } from 'shared/user/useAvailableCredit'
import { InfoBanner } from 'ui/components/banners/InfoBanner'
Expand Down Expand Up @@ -70,7 +70,7 @@ export const PriceModal: FunctionComponent<PriceModalProps> = ({
const { isLoggedIn, user } = useAuthContext()

const availableCredit = useAvailableCredit()?.amount ?? 0
const formatAvailableCredit = formatCurrencyFromCentsWithoutCurrenySymbol(
const formatAvailableCredit = formatCurrencyFromCentsWithoutCurrencySymbol(
availableCredit,
currency,
euroToPacificFrancRate
Expand All @@ -83,7 +83,7 @@ export const PriceModal: FunctionComponent<PriceModalProps> = ({
const bannerTitle = `Il te reste ${formatAvailableCreditWithCurrency} sur ton pass Culture.`

const initialCredit = user?.domainsCredit?.all?.initial ?? MAX_PRICE_IN_CENTS
const formatInitialCredit = formatCurrencyFromCentsWithoutCurrenySymbol(
const formatInitialCredit = formatCurrencyFromCentsWithoutCurrencySymbol(
initialCredit,
currency,
euroToPacificFrancRate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable prettier/prettier */
import { DEFAULT_PACIFIC_FRANC_TO_EURO_RATE } from 'libs/firebase/firestore/exchangeRates/useGetPacificFrancToEuroRate'
import { Currency } from 'shared/currency/useGetCurrencyToDisplay'

import { formatCurrencyFromCentsWithoutCurrenySymbol } from './formatCurrencyFromCentsWithoutCurrenySymbol'
import { formatCurrencyFromCentsWithoutCurrencySymbol } from './formatCurrencyFromCentsWithoutCurrencySymbol'

describe('formatCurrencyFromCentsWithoutCurrenySymbol()', () => {
describe('formatCurrencyFromCentsWithoutCurrencySymbol()', () => {
it.each`
priceInCents | currency | expected
${0} | ${Currency.EURO} | ${0}
Expand All @@ -21,10 +20,10 @@ describe('formatCurrencyFromCentsWithoutCurrenySymbol()', () => {
${-1199} | ${Currency.EURO} | ${-11.99}
${100} | ${Currency.PACIFIC_FRANC_SHORT} | ${120}
`(
'formatCurrencyFromCentsWithoutCurrenySymbol($priceInCents) = $expected without format price options',
'formatCurrencyFromCentsWithoutCurrencySymbol($priceInCents) = $expected without format price options',
({ priceInCents, currency, expected }) => {
expect(
formatCurrencyFromCentsWithoutCurrenySymbol(
formatCurrencyFromCentsWithoutCurrencySymbol(
priceInCents,
currency,
DEFAULT_PACIFIC_FRANC_TO_EURO_RATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { convertCentsToEuros } from 'libs/parsers/pricesConversion'
import { RoundUnit, convertEuroToPacificFranc } from 'shared/currency/convertEuroToPacificFranc'
import { Currency } from 'shared/currency/useGetCurrencyToDisplay'

export const formatCurrencyFromCentsWithoutCurrenySymbol = (
export const formatCurrencyFromCentsWithoutCurrencySymbol = (
priceInCents: number,
currency: Currency,
euroToPacificFrancRate: number
Expand Down

0 comments on commit 62f2aa2

Please sign in to comment.