Merged in chore/add-tests-to-getAdditionalPrice (pull request #3065)
chore: Refactor types and add tests to parts of price calcuations * Add tests to sumPackages * Refactor types and add tests to getAdditionalPrice * Don't always generate coverage * Add tests and refactor types of getRedemptionPrice Approved-by: Joakim Jäderberg
This commit is contained in:
@@ -8,7 +8,8 @@ import { ChildBedMapEnum } from "@scandic-hotels/trpc/enums/childBedMapEnum"
|
||||
import { ChildBedTypeEnum } from "@scandic-hotels/trpc/enums/childBedTypeEnum"
|
||||
import { RoomPackageCodeEnum } from "@scandic-hotels/trpc/enums/roomFilter"
|
||||
|
||||
import type { Package, Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { CurrencyEnum } from "@scandic-hotels/common/constants/currency"
|
||||
import type { Packages } from "@scandic-hotels/trpc/types/packages"
|
||||
import type { JSX } from "react"
|
||||
|
||||
import type { RoomPackageCodes } from "../../types/components/selectRate/roomFilter"
|
||||
@@ -39,7 +40,10 @@ export const invertedBedTypeMap: Record<ChildBedTypeEnum, string> = {
|
||||
}
|
||||
|
||||
export function sumPackages(
|
||||
packages: Pick<Package, "localPrice">[] | undefined | null
|
||||
packages:
|
||||
| { localPrice: { totalPrice: number; currency?: CurrencyEnum } }[]
|
||||
| null
|
||||
| undefined
|
||||
) {
|
||||
if (!packages || !packages.length) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user