diff --git a/src/normalizers/index.test.ts b/src/normalizers/index.test.ts index 5a8a052..9ab8bf0 100644 --- a/src/normalizers/index.test.ts +++ b/src/normalizers/index.test.ts @@ -62,6 +62,11 @@ describe('normalizeTimeFrequency', () => { ${24000} | ${'yearly'} | ${'Monthly'} | ${2000} ${24000} | ${'yearly'} | ${undefined} | ${24000} ${24000} | ${undefined} | ${'monthly'} | ${24000} + ${'2400.5'} | ${'monthly'} | ${'weekly'} | ${600.125} + ${'1000'} | ${'monthly'} | ${'yearly'} | ${12000} + ${'1000.50'}| ${'monthly'} | ${'yearly'} | ${12006} + ${'12006'} | ${'yearly'} | ${'monthly'} | ${1000.50} + ${'159.345'}| ${'yearly'} | ${'monthly'} | ${13.2788} `( `should normalize $timeValue/$timeValueFrequency properly to time frequency $targetTimeFrequency`, ({ timeValue, timeValueFrequency, targetTimeFrequency, expectedNormalizedValue }) => { diff --git a/src/types/index.d.ts b/src/types/index.d.ts index efcc72d..b8daea4 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -27,13 +27,13 @@ export type TimeFrequency = Exclude; export type PriceTier = Components.Schemas.PriceTier; export type PriceTierDisplayMode = Components.Schemas.PriceTierDisplayMode; export type NormalizeTimeFrequency = ( - timeValue: number, + timeValue: number | string, timeValueFrequency: TimeFrequency, targetTimeFrequency: TimeFrequency, precision?: number, ) => number; export type NormalizeTimeFrequencyToDinero = ( - timeValue: number, + timeValue: number | string, timeValueFrequency: TimeFrequency, targetTimeFrequency: TimeFrequency, precision?: number,