@hyper.software/common-helpers 1.2.3 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  var node_test_1 = require("node:test");
7
4
  var bookingsService_1 = require("./bookingsService");
8
- var moment_1 = __importDefault(require("moment"));
9
5
  var roomBookingServices_1 = require("../roomBookingServices");
10
6
  var booking1 = {
11
7
  id: 'df0c780c-d571-490d-9e0b-3e00b0009dab',
12
8
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
13
9
  customerId: '5a4ddf3a-b6cb-4ae1-ade0-f7687b08ff30',
14
10
  checkinDate: '2024-10-14T12:00:00.000Z',
15
- checkoutDate: '2024-10-17T05:00:00.000Z',
11
+ checkoutDate: '2024-10-16T05:00:00.000Z',
16
12
  code: '45KTUH',
17
13
  bookingSource: 'IMPORT',
18
14
  details: null,
@@ -3460,7 +3456,7 @@ var booking2 = {
3460
3456
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
3461
3457
  customerId: '402dd487-be67-4fad-9cee-9dd0162b698d',
3462
3458
  checkinDate: '2024-10-14T12:00:00.000Z',
3463
- checkoutDate: '2024-10-17T05:00:00.000Z',
3459
+ checkoutDate: '2024-10-16T05:00:00.000Z',
3464
3460
  code: 'WTRW01',
3465
3461
  bookingSource: 'IMPORT',
3466
3462
  details: null,
@@ -6887,7 +6883,7 @@ var booking3 = {
6887
6883
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
6888
6884
  customerId: '4bec6b6f-d838-4d60-9f53-75c8791fdcfd',
6889
6885
  checkinDate: '2024-10-14T12:00:00.000Z',
6890
- checkoutDate: '2024-10-17T05:00:00.000Z',
6886
+ checkoutDate: '2024-10-16T05:00:00.000Z',
6891
6887
  code: 'M0411Y',
6892
6888
  bookingSource: 'IMPORT',
6893
6889
  details: null,
@@ -13741,7 +13737,7 @@ var booking5 = {
13741
13737
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
13742
13738
  customerId: '0a1d90c7-4558-4ee6-b467-3439c9ccf3ec',
13743
13739
  checkinDate: '2024-10-14T12:00:00.000Z',
13744
- checkoutDate: '2024-10-17T05:00:00.000Z',
13740
+ checkoutDate: '2024-10-16T05:00:00.000Z',
13745
13741
  code: '4HEU4C',
13746
13742
  bookingSource: 'IMPORT',
13747
13743
  details: null,
@@ -13767,8 +13763,13 @@ var booking5 = {
13767
13763
  roomId: '821101e0-c196-42b5-b225-d4306fa7fdee',
13768
13764
  bookingId: 'bbea69a7-21df-40c7-b8e2-9cc151432919',
13769
13765
  checkinDate: '2024-10-14T12:00:00.000Z',
13770
- checkoutDate: '2024-10-17T05:00:00.000Z',
13766
+ checkoutDate: '2024-10-16T05:00:00.000Z',
13771
13767
  breakfastIncluded: false,
13768
+ childrenAges: [
13769
+ {
13770
+ age: 5,
13771
+ },
13772
+ ],
13772
13773
  numberOfAdults: 1,
13773
13774
  numberOfChildren: 1,
13774
13775
  pricePerNight: 159,
@@ -17189,7 +17190,7 @@ var booking6 = {
17189
17190
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
17190
17191
  customerId: '6172d2a9-f4ec-423f-84ff-6cf0d7a9bde7',
17191
17192
  checkinDate: '2024-10-14T12:00:00.000Z',
17192
- checkoutDate: '2024-10-17T05:00:00.000Z',
17193
+ checkoutDate: '2024-10-16T05:00:00.000Z',
17193
17194
  code: 'TKR84P',
17194
17195
  bookingSource: 'IMPORT',
17195
17196
  details: null,
@@ -17215,8 +17216,22 @@ var booking6 = {
17215
17216
  roomId: '91a09381-d809-4a52-86a7-8c9535ea2c6d',
17216
17217
  bookingId: 'f36a7ed1-66f1-45f4-8342-a1146bc23402',
17217
17218
  checkinDate: '2024-10-14T12:00:00.000Z',
17218
- checkoutDate: '2024-10-17T05:00:00.000Z',
17219
+ checkoutDate: '2024-10-16T05:00:00.000Z',
17219
17220
  breakfastIncluded: false,
17221
+ childrenAges: [
17222
+ {
17223
+ age: 5,
17224
+ },
17225
+ {
17226
+ age: 8,
17227
+ },
17228
+ {
17229
+ age: 14,
17230
+ },
17231
+ {
17232
+ age: 17,
17233
+ },
17234
+ ],
17220
17235
  numberOfAdults: 1,
17221
17236
  numberOfChildren: 4,
17222
17237
  pricePerNight: 219,
@@ -20637,7 +20652,7 @@ var booking7 = {
20637
20652
  companyId: 'd82ba143-3b0d-4569-972a-be7c3244901c',
20638
20653
  customerId: '8a0a76f9-3cb6-486f-a67c-d186ee50ec0a',
20639
20654
  checkinDate: '2024-10-14T12:00:00.000Z',
20640
- checkoutDate: '2024-10-17T05:00:00.000Z',
20655
+ checkoutDate: '2024-10-16T05:00:00.000Z',
20641
20656
  code: '54XYMC',
20642
20657
  bookingSource: 'IMPORT',
20643
20658
  details: null,
@@ -20663,8 +20678,22 @@ var booking7 = {
20663
20678
  roomId: '186dee36-078f-4cf6-bf2c-fc5906af3968',
20664
20679
  bookingId: '8a6a6d1e-b759-42ab-8168-b0281a48d1bb',
20665
20680
  checkinDate: '2024-10-14T12:00:00.000Z',
20666
- checkoutDate: '2024-10-17T05:00:00.000Z',
20681
+ checkoutDate: '2024-10-16T05:00:00.000Z',
20667
20682
  breakfastIncluded: false,
20683
+ childrenAges: [
20684
+ {
20685
+ age: 1,
20686
+ },
20687
+ {
20688
+ age: 5,
20689
+ },
20690
+ {
20691
+ age: 14,
20692
+ },
20693
+ {
20694
+ age: 17,
20695
+ },
20696
+ ],
20668
20697
  numberOfAdults: 1,
20669
20698
  numberOfChildren: 4,
20670
20699
  pricePerNight: 209.1,
@@ -24117,6 +24146,20 @@ var booking8 = {
24117
24146
  checkinDate: '2024-10-14T12:00:00.000Z',
24118
24147
  checkoutDate: '2024-10-17T05:00:00.000Z',
24119
24148
  breakfastIncluded: false,
24149
+ childrenAges: [
24150
+ {
24151
+ age: 1,
24152
+ },
24153
+ {
24154
+ age: 5,
24155
+ },
24156
+ {
24157
+ age: 14,
24158
+ },
24159
+ {
24160
+ age: 17,
24161
+ },
24162
+ ],
24120
24163
  numberOfAdults: 6,
24121
24164
  numberOfChildren: 4,
24122
24165
  pricePerNight: 244,
@@ -28462,117 +28505,152 @@ var company = {
28462
28505
  isDefault: true,
28463
28506
  };
28464
28507
  (0, node_test_1.describe)('GIVEN bookingsService', function () {
28465
- it('SHOULD compute the correct accommodation cost for case 1 - A 3 day booking at the normal price without OBP or Length of stay Discount', function () {
28466
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking1.roomBookings, (0, moment_1.default)(booking1.checkinDate), (0, moment_1.default)(booking1.checkoutDate), booking1, company, false);
28467
- expect(accommodationCost).toBe(447);
28468
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking1);
28508
+ it('SHOULD compute the correct accommodation cost for case 1 - A 2 day booking at the normal price without OBP or Length of stay Discount', function () {
28509
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking1);
28510
+ expect(accommodationCost).toBe(298);
28511
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking1, company);
28469
28512
  expect(servicesCost).toBe(0);
28470
28513
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking1);
28471
28514
  expect(breakfastCost).toBe(0);
28472
28515
  var childrenCost = (0, roomBookingServices_1.getChildrenCost)(booking1);
28473
28516
  expect(childrenCost).toBe(0);
28474
28517
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking1, company);
28475
- expect(lengthOfStayDiscount).toBe(417);
28476
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking1);
28518
+ expect(lengthOfStayDiscount).toBe(0);
28519
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking1);
28477
28520
  expect(discountOrIncreaseAmount).toBe(0);
28478
28521
  });
28479
- it('SHOULD compute the correct accommodation cost for case 2 - A 3-day booking with a reduced price by OBP and without Length of Stay Discount', function () {
28480
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking2.roomBookings, (0, moment_1.default)(booking2.checkinDate), (0, moment_1.default)(booking1.checkoutDate), booking2, company, false);
28481
- expect(accommodationCost).toBe(417);
28482
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking2);
28522
+ it('SHOULD compute the correct accommodation cost for case 2 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount', function () {
28523
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking2);
28524
+ expect(accommodationCost).toBe(298);
28525
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking2, company);
28483
28526
  expect(servicesCost).toBe(0);
28484
28527
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking2);
28485
28528
  expect(breakfastCost).toBe(0);
28486
28529
  var childrenCost = (0, roomBookingServices_1.getChildrenCost)(booking2);
28487
28530
  expect(childrenCost).toBe(0);
28488
28531
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking2, company);
28489
- expect(lengthOfStayDiscount).toBe(387);
28490
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking2);
28491
- expect(discountOrIncreaseAmount).toBe(0);
28532
+ expect(lengthOfStayDiscount).toBe(0);
28533
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking2);
28534
+ expect(discountOrIncreaseAmount).toBe(-10);
28492
28535
  });
28493
- it('SHOULD compute the correct accommodation cost for case 3 - A 3-day booking with an increased price by OBP and without Length of Stay Discount ', function () {
28494
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking3.roomBookings, (0, moment_1.default)(booking3.checkinDate), (0, moment_1.default)(booking3.checkoutDate), booking7, company, false);
28495
- expect(accommodationCost).toBe(477);
28496
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking3);
28536
+ it('SHOULD compute the correct accommodation cost for case 3 - A 2-day booking with an increased price by OBP and without Length of Stay Discount ', function () {
28537
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking3);
28538
+ expect(accommodationCost).toBe(298);
28539
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking3, company);
28497
28540
  expect(servicesCost).toBe(0);
28498
28541
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking3);
28499
28542
  expect(breakfastCost).toBe(0);
28500
28543
  var childrenCost = (0, roomBookingServices_1.getChildrenCost)(booking3);
28501
28544
  expect(childrenCost).toBe(0);
28502
28545
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking3, company);
28503
- expect(lengthOfStayDiscount).toBe(447);
28504
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking3);
28505
- expect(discountOrIncreaseAmount).toBe(0);
28546
+ expect(lengthOfStayDiscount).toBe(0);
28547
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking3);
28548
+ expect(discountOrIncreaseAmount).toBe(10);
28506
28549
  });
28507
28550
  it('SHOULD compute the correct accommodation cost for case 4 - A 3-day booking with a reduced price by OBP and by the Length of Stay Discount ', function () {
28508
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking4.roomBookings, (0, moment_1.default)(booking4.checkinDate), (0, moment_1.default)(booking4.checkoutDate), booking4, company, false);
28509
- expect(accommodationCost).toBe(417);
28510
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking4);
28551
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking4);
28552
+ expect(accommodationCost).toBe(447);
28553
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking4, company);
28511
28554
  expect(servicesCost).toBe(0);
28512
28555
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking4);
28513
28556
  expect(breakfastCost).toBe(0);
28514
- // const childrenCost: number = getChildrenCost(booking4)
28515
- // expect(childrenCost).toBe(0)
28557
+ var childrenCost = (0, roomBookingServices_1.getChildrenCost)(booking4);
28558
+ expect(childrenCost).toBe(0);
28516
28559
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking4, company);
28517
- expect(lengthOfStayDiscount).toBe(387);
28518
- // const discountOrIncreaseAmount = getDiscountOrIncreaseAmount(booking4)
28519
- // expect(discountOrIncreaseAmount).toBe(30)
28560
+ expect(lengthOfStayDiscount).toBe(-30);
28561
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking4);
28562
+ expect(discountOrIncreaseAmount).toBe(-10);
28563
+ var totalBookingCost = accommodationCost +
28564
+ servicesCost +
28565
+ breakfastCost +
28566
+ childrenCost +
28567
+ lengthOfStayDiscount +
28568
+ discountOrIncreaseAmount * (0, roomBookingServices_1.getLengthOfStayRoomBooking)(booking4);
28569
+ expect(totalBookingCost).toBe(387);
28520
28570
  });
28521
- it('SHOULD compute the correct accommodation cost for case 5 - A 3-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range, 10 euros per night increase)', function () {
28522
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking5.roomBookings, (0, moment_1.default)(booking5.checkinDate), (0, moment_1.default)(booking5.checkoutDate), booking5, company, false);
28523
- expect(accommodationCost).toBe(477);
28524
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking5);
28571
+ it('SHOULD compute the correct accommodation cost for case 5 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range, 10 euros per night increase)', function () {
28572
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking5);
28573
+ expect(accommodationCost).toBe(298);
28574
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking5, company);
28525
28575
  expect(servicesCost).toBe(0);
28526
28576
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking5);
28527
28577
  expect(breakfastCost).toBe(0);
28528
- // const childrenCost: number = getChildrenCost(booking5)
28529
- // expect(childrenCost).toBe(30)
28578
+ var childrenCost = (0, bookingsService_1.getTotalChildrenCost)(booking5);
28579
+ expect(childrenCost).toBe(20);
28530
28580
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking5, company);
28531
- expect(lengthOfStayDiscount).toBe(447);
28532
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking5);
28581
+ expect(lengthOfStayDiscount).toBe(0);
28582
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking5);
28533
28583
  expect(discountOrIncreaseAmount).toBe(0);
28584
+ var totalBookingCost = accommodationCost +
28585
+ servicesCost +
28586
+ breakfastCost +
28587
+ childrenCost +
28588
+ lengthOfStayDiscount +
28589
+ discountOrIncreaseAmount * (0, roomBookingServices_1.getLengthOfStayRoomBooking)(booking5); // dont forget the children cost
28590
+ expect(totalBookingCost).toBe(318);
28534
28591
  });
28535
- it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking at the normal price without OBP or Length of Stay Discount, with 4 children of various age ranges ', function () {
28536
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking6.roomBookings, (0, moment_1.default)(booking6.checkinDate), (0, moment_1.default)(booking6.checkoutDate), booking6, company, false);
28537
- expect(accommodationCost).toBe(657);
28538
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking6);
28592
+ it('SHOULD compute the correct accommodation cost for case 6 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 4 children of various age ranges ', function () {
28593
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking6);
28594
+ expect(accommodationCost).toBe(298);
28595
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking6, company);
28539
28596
  expect(servicesCost).toBe(0);
28540
28597
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking6);
28541
28598
  expect(breakfastCost).toBe(0);
28542
- // const childrenCost: number = getChildrenCost(booking6)
28543
- // expect(childrenCost).toBe(0)
28599
+ var childrenCost = (0, bookingsService_1.getTotalChildrenCost)(booking6);
28600
+ expect(childrenCost).toBe(140);
28544
28601
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking6, company);
28545
- expect(lengthOfStayDiscount).toBe(627);
28546
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking6);
28602
+ expect(lengthOfStayDiscount).toBe(0);
28603
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking6);
28547
28604
  expect(discountOrIncreaseAmount).toBe(0);
28605
+ var totalBookingCost = accommodationCost +
28606
+ servicesCost +
28607
+ breakfastCost +
28608
+ childrenCost +
28609
+ lengthOfStayDiscount +
28610
+ discountOrIncreaseAmount * (0, roomBookingServices_1.getLengthOfStayRoomBooking)(booking6);
28611
+ expect(totalBookingCost).toBe(438);
28548
28612
  });
28549
- it('SHOULD compute the correct accommodation cost for case 7 - A 3-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges', function () {
28550
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking7.roomBookings, (0, moment_1.default)(booking7.checkinDate), (0, moment_1.default)(booking7.checkoutDate), booking7, company, false);
28551
- expect(accommodationCost).toBe(627.3);
28552
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking7);
28613
+ it('SHOULD compute the correct accommodation cost for case 7 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges', function () {
28614
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking7);
28615
+ expect(accommodationCost).toBe(298);
28616
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking7, company);
28553
28617
  expect(servicesCost).toBe(0);
28554
28618
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking7);
28555
28619
  expect(breakfastCost).toBe(0);
28556
- // const childrenCost: number = getChildrenCost(booking7)
28557
- // expect(childrenCost).toBe(0)
28620
+ var childrenCost = (0, bookingsService_1.getTotalChildrenCost)(booking7);
28621
+ expect(childrenCost).toBe(150);
28558
28622
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking7, company);
28559
- expect(lengthOfStayDiscount).toBe(597.3);
28560
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking7);
28561
- expect(discountOrIncreaseAmount).toBe(0);
28623
+ expect(lengthOfStayDiscount).toBe(0);
28624
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking7);
28625
+ expect(discountOrIncreaseAmount).toBe(-14.9);
28626
+ var totalBookingCost = accommodationCost +
28627
+ servicesCost +
28628
+ breakfastCost +
28629
+ childrenCost +
28630
+ lengthOfStayDiscount +
28631
+ discountOrIncreaseAmount * (0, roomBookingServices_1.getLengthOfStayRoomBooking)(booking7);
28632
+ expect(totalBookingCost).toBe(418.2);
28562
28633
  });
28563
28634
  it('SHOULD compute the correct accommodation cost for case 8 - A 3-day booking with an increased price by OBP and with Length of Stay Discount, with 4 children of various age ranges', function () {
28564
- var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking8.roomBookings, (0, moment_1.default)(booking8.checkinDate), (0, moment_1.default)(booking8.checkoutDate), booking8, company, false);
28565
- expect(accommodationCost).toBe(732);
28566
- var servicesCost = (0, bookingsService_1.getServicesCost)(booking8);
28635
+ var accommodationCost = (0, bookingsService_1.getAccommodationCost)(booking8);
28636
+ expect(accommodationCost).toBe(447);
28637
+ var servicesCost = (0, bookingsService_1.getServicesCost)(booking8, company);
28567
28638
  expect(servicesCost).toBe(0);
28568
28639
  var breakfastCost = (0, bookingsService_1.getBreakfastCost)(booking8);
28569
28640
  expect(breakfastCost).toBe(0);
28570
- // const childrenCost: number = getChildrenCost(booking8)
28571
- // expect(childrenCost).toBe(0)
28641
+ var childrenCost = (0, bookingsService_1.getTotalChildrenCost)(booking8);
28642
+ expect(childrenCost).toBe(225);
28572
28643
  var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(booking8, company);
28573
- expect(lengthOfStayDiscount).toBe(702);
28574
- var discountOrIncreaseAmount = (0, roomBookingServices_1.getDiscountOrIncreaseAmount)(booking8);
28575
- expect(discountOrIncreaseAmount).toBe(30);
28644
+ expect(lengthOfStayDiscount).toBe(-30);
28645
+ var discountOrIncreaseAmount = (0, bookingsService_1.getOccupancyBasedPricingDiscount)(booking8);
28646
+ expect(discountOrIncreaseAmount).toBe(20); // this is per day
28647
+ var totalBookingCost = accommodationCost +
28648
+ servicesCost +
28649
+ breakfastCost +
28650
+ childrenCost +
28651
+ lengthOfStayDiscount +
28652
+ discountOrIncreaseAmount * (0, roomBookingServices_1.getLengthOfStayRoomBooking)(booking7);
28653
+ expect(totalBookingCost).toBe(682);
28576
28654
  });
28577
28655
  });
28578
28656
  //# sourceMappingURL=bookingsService.test.js.map