@@ -38,6 +38,7 @@ import {
3838 isReservationUnitPaidInFuture ,
3939 isReservationUnitPublished ,
4040 isReservationUnitReservable ,
41+ GetPriceType ,
4142} from "../reservationUnit" ;
4243import mockTranslations from "../../public/locales/fi/prices.json" ;
4344import { type ReservableMap , dateToKey , type RoundPeriod } from "../reservable" ;
@@ -217,7 +218,7 @@ describe("getPriceString", () => {
217218 highestPrice ?: number ;
218219 priceUnit ?: PriceUnit ;
219220 minutes ?: number ;
220- } ) {
221+ } ) : GetPriceType {
221222 return {
222223 pricing : constructPricing ( {
223224 lowestPrice,
@@ -234,7 +235,7 @@ describe("getPriceString", () => {
234235 highestPrice : 50.5 ,
235236 priceUnit : PriceUnit . Per_15Mins ,
236237 } ) ;
237- expect ( getPriceString ( input ) ) . toBe ( "10 - 50,5 € / 15 min" ) ;
238+ expect ( getPriceString ( input ) ) . toBe ( "10,00 - 50,50 € / 15 min" ) ;
238239 } ) ;
239240
240241 test ( "price range with no min" , ( ) => {
@@ -243,7 +244,7 @@ describe("getPriceString", () => {
243244 highestPrice : 50.5 ,
244245 priceUnit : PriceUnit . Per_15Mins ,
245246 } ) ;
246- expect ( getPriceString ( input ) ) . toBe ( "0 - 50,5 € / 15 min" ) ;
247+ expect ( getPriceString ( input ) ) . toBe ( "0 - 50,50 € / 15 min" ) ;
247248 } ) ;
248249
249250 test ( "price range with minutes" , ( ) => {
@@ -252,7 +253,7 @@ describe("getPriceString", () => {
252253 highestPrice : 60.5 ,
253254 minutes : 60 ,
254255 } ) ;
255- expect ( getPriceString ( input ) ) . toBe ( "0 - 60,5 €" ) ;
256+ expect ( getPriceString ( input ) ) . toBe ( "0 - 60,50 €" ) ;
256257 } ) ;
257258
258259 test ( "price range with minutes" , ( ) => {
@@ -270,7 +271,7 @@ describe("getPriceString", () => {
270271 highestPrice : 100 ,
271272 minutes : 61 ,
272273 } ) ;
273- expect ( getPriceString ( input ) ) . toBe ( "0 - 125 €" ) ;
274+ expect ( getPriceString ( input ) ) . toBe ( "0 - 125,00 €" ) ;
274275 } ) ;
275276
276277 test ( "price range with minutes" , ( ) => {
@@ -279,7 +280,7 @@ describe("getPriceString", () => {
279280 highestPrice : 100 ,
280281 minutes : 90 ,
281282 } ) ;
282- expect ( getPriceString ( input ) ) . toBe ( "0 - 150 €" ) ;
283+ expect ( getPriceString ( input ) ) . toBe ( "0 - 150,00 €" ) ;
283284 } ) ;
284285
285286 test ( "price range with minutes" , ( ) => {
@@ -288,7 +289,7 @@ describe("getPriceString", () => {
288289 highestPrice : 100 ,
289290 minutes : 91 ,
290291 } ) ;
291- expect ( getPriceString ( input ) ) . toBe ( "0 - 175 €" ) ;
292+ expect ( getPriceString ( input ) ) . toBe ( "0 - 175,00 €" ) ;
292293 } ) ;
293294
294295 test ( "price range with minutes" , ( ) => {
@@ -298,7 +299,7 @@ describe("getPriceString", () => {
298299 minutes : 60 ,
299300 priceUnit : PriceUnit . Per_15Mins ,
300301 } ) ;
301- expect ( getPriceString ( input ) ) . toBe ( "0 - 120 €" ) ;
302+ expect ( getPriceString ( input ) ) . toBe ( "0 - 120,00 €" ) ;
302303 } ) ;
303304
304305 test ( "price range with minutes" , ( ) => {
@@ -308,7 +309,7 @@ describe("getPriceString", () => {
308309 minutes : 60 ,
309310 priceUnit : PriceUnit . Per_30Mins ,
310311 } ) ;
311- expect ( getPriceString ( input ) ) . toBe ( "0 - 60 €" ) ;
312+ expect ( getPriceString ( input ) ) . toBe ( "0 - 60,00 €" ) ;
312313 } ) ;
313314
314315 test ( "price range with minutes" , ( ) => {
@@ -318,7 +319,7 @@ describe("getPriceString", () => {
318319 minutes : 61 ,
319320 priceUnit : PriceUnit . Per_30Mins ,
320321 } ) ;
321- expect ( getPriceString ( input ) ) . toBe ( "0 - 75 €" ) ;
322+ expect ( getPriceString ( input ) ) . toBe ( "0 - 75,00 €" ) ;
322323 } ) ;
323324
324325 test ( "price range with minutes and fixed unit" , ( ) => {
@@ -328,7 +329,7 @@ describe("getPriceString", () => {
328329 minutes : 61 ,
329330 priceUnit : PriceUnit . PerHalfDay ,
330331 } ) ;
331- expect ( getPriceString ( input ) ) . toBe ( "10 - 100 €" ) ;
332+ expect ( getPriceString ( input ) ) . toBe ( "10,00 - 100,00 €" ) ;
332333 } ) ;
333334
334335 test ( "price range with minutes and fixed unit" , ( ) => {
@@ -338,7 +339,7 @@ describe("getPriceString", () => {
338339 minutes : 1234 ,
339340 priceUnit : PriceUnit . PerDay ,
340341 } ) ;
341- expect ( getPriceString ( input ) ) . toBe ( "10 - 100 €" ) ;
342+ expect ( getPriceString ( input ) ) . toBe ( "10,00 - 100,00 €" ) ;
342343 } ) ;
343344
344345 test ( "price range with minutes and fixed unit" , ( ) => {
@@ -348,7 +349,7 @@ describe("getPriceString", () => {
348349 minutes : 1234 ,
349350 priceUnit : PriceUnit . PerWeek ,
350351 } ) ;
351- expect ( getPriceString ( input ) ) . toBe ( "10 - 100 €" ) ;
352+ expect ( getPriceString ( input ) ) . toBe ( "10,00 - 100,00 €" ) ;
352353 } ) ;
353354
354355 test ( "fixed price" , ( ) => {
@@ -357,16 +358,7 @@ describe("getPriceString", () => {
357358 highestPrice : 50 ,
358359 priceUnit : PriceUnit . Fixed ,
359360 } ) ;
360- expect ( getPriceString ( input ) ) . toBe ( "50 €" ) ;
361- } ) ;
362-
363- test ( "fixed price with decimals" , ( ) => {
364- const input = constructInput ( {
365- lowestPrice : 50 ,
366- highestPrice : 50 ,
367- priceUnit : PriceUnit . Fixed ,
368- } ) ;
369- expect ( getPriceString ( { ...input , trailingZeros : true } ) ) . toBe ( "50,00 €" ) ;
361+ expect ( getPriceString ( input ) ) . toBe ( "50,00 €" ) ;
370362 } ) ;
371363
372364 test ( "no price" , ( ) => {
@@ -384,19 +376,7 @@ describe("getPriceString", () => {
384376 minutes : 180 ,
385377 priceUnit : PriceUnit . Per_15Mins ,
386378 } ) ;
387- expect ( getPriceString ( input ) ) . toBe ( "0 - 606 €" ) ;
388- } ) ;
389-
390- test ( "total price with minutes and decimals" , ( ) => {
391- const input = constructInput ( {
392- lowestPrice : 0 ,
393- highestPrice : 50.5 ,
394- minutes : 180 ,
395- priceUnit : PriceUnit . Per_15Mins ,
396- } ) ;
397- expect ( getPriceString ( { ...input , trailingZeros : true } ) ) . toBe (
398- "0 - 606,00 €"
399- ) ;
379+ expect ( getPriceString ( input ) ) . toBe ( "0 - 606,00 €" ) ;
400380 } ) ;
401381} ) ;
402382
@@ -1041,7 +1021,6 @@ describe("getReservationUnitPrice", () => {
10411021 } ) : GetReservationUnitPriceProps {
10421022 return {
10431023 pricingDate : date ,
1044- trailingZeros : true ,
10451024 reservationUnit : {
10461025 pricings : [
10471026 constructPricing ( {
0 commit comments