@hyper.software/common-helpers 1.11.19 → 1.11.21
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.
- package/lib/services/bookingService/__tests__/bookingInvoiceService.getAdultAndChildrenCount.test.js +5 -5
- package/lib/services/bookingService/__tests__/bookingInvoiceService.getAdultAndChildrenCount.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingInvoiceService.test.js +10 -46
- package/lib/services/bookingService/__tests__/bookingInvoiceService.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingService.initialiseProducts.test.js +18 -72
- package/lib/services/bookingService/__tests__/bookingService.initialiseProducts.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingServicesService.getBookingServiceTotalCost.test.js +2 -23
- package/lib/services/bookingService/__tests__/bookingServicesService.getBookingServiceTotalCost.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.getAccommodationCost.test.js +37 -37
- package/lib/services/bookingService/__tests__/bookingsService.getAccommodationCost.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.getChildrenCost.test.js +54 -54
- package/lib/services/bookingService/__tests__/bookingsService.getChildrenCost.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.getLengthOfStay.test.js +36 -36
- package/lib/services/bookingService/__tests__/bookingsService.getLengthOfStay.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.getSeasonalNights.test.js +13 -0
- package/lib/services/bookingService/__tests__/bookingsService.getSeasonalNights.test.js.map +1 -0
- package/lib/services/bookingService/__tests__/bookingsService.getServicesCost.test.js +26 -26
- package/lib/services/bookingService/__tests__/bookingsService.getServicesCost.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.getTotalCost.test.js +35 -35
- package/lib/services/bookingService/__tests__/bookingsService.getTotalCost.test.js.map +1 -1
- package/lib/services/bookingService/__tests__/bookingsService.manualComputeTotalCost.test.js +154 -151
- package/lib/services/bookingService/__tests__/bookingsService.manualComputeTotalCost.test.js.map +1 -1
- package/lib/services/bookingService/bookingsService.js +2 -1
- package/lib/services/bookingService/bookingsService.js.map +1 -1
- package/lib/testingData/bookingData.d.ts +0 -13
- package/lib/testingData/bookingData.js +700 -77977
- package/lib/testingData/bookingData.js.map +1 -1
- package/lib/testingData/roomsData.d.ts +4670 -0
- package/lib/testingData/roomsData.js +4746 -0
- package/lib/testingData/roomsData.js.map +1 -0
- package/package.json +1 -1
- package/lib/services/bookingService/__tests__/bookingsService. getSeasonalNights.test.js +0 -19
- package/lib/services/bookingService/__tests__/bookingsService. getSeasonalNights.test.js.map +0 -1
- /package/lib/services/bookingService/__tests__/{bookingsService. getSeasonalNights.test.d.ts → bookingsService.getSeasonalNights.test.d.ts} +0 -0
|
@@ -9,43 +9,43 @@ describe('WHEN testing .getLengthOfStay()', function () {
|
|
|
9
9
|
});
|
|
10
10
|
it('SHOULD compute the correct length of stay for booking2', function () {
|
|
11
11
|
var lengthOfStay = (0, bookingsService_1.getLengthOfStay)(bookingData_1.booking2);
|
|
12
|
-
expect(lengthOfStay).toBe(2);
|
|
13
|
-
});
|
|
14
|
-
it('SHOULD compute the correct length of stay for booking3', function () {
|
|
15
|
-
var lengthOfStay = (0, bookingsService_1.getLengthOfStay)(bookingData_1.booking3);
|
|
16
|
-
expect(lengthOfStay).toBe(2);
|
|
17
|
-
});
|
|
18
|
-
it('SHOULD compute the correct length of stay for booking4', function () {
|
|
19
|
-
var lengthOfStay = (0, bookingsService_1.getLengthOfStay)(bookingData_1.booking4);
|
|
20
|
-
expect(lengthOfStay).toBe(2);
|
|
21
|
-
});
|
|
22
|
-
it('SHOULD compute the correct length of stay for booking5', function () {
|
|
23
|
-
var lengthOfStay = (0, bookingsService_1.getLengthOfStay)(bookingData_1.booking5);
|
|
24
12
|
expect(lengthOfStay).toBe(3);
|
|
25
13
|
});
|
|
26
|
-
it('SHOULD compute the correct length of stay for
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})
|
|
30
|
-
it('SHOULD compute the correct length of stay for
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
it('SHOULD compute the correct length of stay for
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
it('SHOULD compute the correct length of stay for
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
it('SHOULD compute the correct length of stay for
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
})
|
|
46
|
-
it('SHOULD compute correct
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
14
|
+
// it('SHOULD compute the correct length of stay for booking3', () => {
|
|
15
|
+
// const lengthOfStay: number = getLengthOfStay(booking3)
|
|
16
|
+
// expect(lengthOfStay).toBe(2)
|
|
17
|
+
// })
|
|
18
|
+
// it('SHOULD compute the correct length of stay for booking4', () => {
|
|
19
|
+
// const lengthOfStay: number = getLengthOfStay(booking4)
|
|
20
|
+
// expect(lengthOfStay).toBe(2)
|
|
21
|
+
// })
|
|
22
|
+
// it('SHOULD compute the correct length of stay for booking5', () => {
|
|
23
|
+
// const lengthOfStay: number = getLengthOfStay(booking5)
|
|
24
|
+
// expect(lengthOfStay).toBe(3)
|
|
25
|
+
// })
|
|
26
|
+
// it('SHOULD compute the correct length of stay for booking6', () => {
|
|
27
|
+
// const lengthOfStay: number = getLengthOfStay(booking6)
|
|
28
|
+
// expect(lengthOfStay).toBe(3)
|
|
29
|
+
// })
|
|
30
|
+
// it('SHOULD compute the correct length of stay for booking7', () => {
|
|
31
|
+
// const lengthOfStay: number = getLengthOfStay(booking7)
|
|
32
|
+
// expect(lengthOfStay).toBe(2)
|
|
33
|
+
// })
|
|
34
|
+
// it('SHOULD compute the correct length of stay for booking8', () => {
|
|
35
|
+
// const lengthOfStay: number = getLengthOfStay(booking8)
|
|
36
|
+
// expect(lengthOfStay).toBe(2)
|
|
37
|
+
// })
|
|
38
|
+
// it('SHOULD compute the correct length of stay for booking9', () => {
|
|
39
|
+
// const lengthOfStay: number = getLengthOfStay(booking9)
|
|
40
|
+
// expect(lengthOfStay).toBe(2)
|
|
41
|
+
// })
|
|
42
|
+
// it('SHOULD compute the correct length of stay for booking10', () => {
|
|
43
|
+
// const lengthOfStay: number = getLengthOfStay(booking10)
|
|
44
|
+
// expect(lengthOfStay).toBe(3)
|
|
45
|
+
// })
|
|
46
|
+
// it('SHOULD compute correct accommodation cost for case 12 - A 4-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay', () => {
|
|
47
|
+
// const lengthOfStay: number = getLengthOfStay(booking12)
|
|
48
|
+
// expect(lengthOfStay).toBe(4)
|
|
49
|
+
// })
|
|
50
50
|
});
|
|
51
51
|
//# sourceMappingURL=bookingsService.getLengthOfStay.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookingsService.getLengthOfStay.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getLengthOfStay.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"bookingsService.getLengthOfStay.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getLengthOfStay.test.ts"],"names":[],"mappings":";;AAAA,gEAAqE;AACrE,sDAAoD;AAEpD,QAAQ,CAAC,iCAAiC,EAAE;IAC1C,EAAE,CAAC,wDAAwD,EAAE;QAC3D,IAAM,YAAY,GAAW,IAAA,iCAAe,EAAC,sBAAQ,CAAC,CAAA;QACtD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wDAAwD,EAAE;QAC3D,IAAM,YAAY,GAAW,IAAA,iCAAe,EAAC,sBAAQ,CAAC,CAAA;QACtD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;IAEF,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,uEAAuE;IACvE,2DAA2D;IAC3D,iCAAiC;IACjC,KAAK;IAEL,wEAAwE;IACxE,4DAA4D;IAC5D,iCAAiC;IACjC,KAAK;IAEL,mLAAmL;IACnL,4DAA4D;IAC5D,iCAAiC;IACjC,KAAK;AACP,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var bookingData_1 = require("../../../testingData/bookingData");
|
|
4
|
+
var bookingsService_1 = require("../bookingsService");
|
|
5
|
+
var startDate = '2025-01-05T05:00:00.000Z';
|
|
6
|
+
var endDate = '2025-10-05T05:00:00.000Z';
|
|
7
|
+
describe('WHEN testing .getSeasonalNights()', function () {
|
|
8
|
+
it('SHOULD compute the correct number of nights for case where a room booking booking service is between the startDate and endDate', function () {
|
|
9
|
+
var nights = (0, bookingsService_1.getSeasonalNights)(bookingData_1.booking1.roomBookingBookingServices[0], startDate, endDate);
|
|
10
|
+
expect(nights).toBe(3);
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=bookingsService.getSeasonalNights.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookingsService.getSeasonalNights.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getSeasonalNights.test.ts"],"names":[],"mappings":";;AAAA,gEAA2D;AAC3D,sDAAsD;AAEtD,IAAM,SAAS,GAAG,0BAA0B,CAAA;AAC5C,IAAM,OAAO,GAAG,0BAA0B,CAAA;AAE1C,QAAQ,CAAC,mCAAmC,EAAE;IAC5C,EAAE,CAAC,gIAAgI,EAAE;QACnI,IAAM,MAAM,GAAG,IAAA,mCAAiB,EAAC,sBAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC5F,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -4,33 +4,33 @@ var bookingData_1 = require("../../../testingData/bookingData");
|
|
|
4
4
|
var companyData_1 = require("../../../testingData/companyData");
|
|
5
5
|
var bookingsService_1 = require("../bookingsService");
|
|
6
6
|
describe('WHEN testing .getServicesCost()', function () {
|
|
7
|
-
it('SHOULD compute the correct
|
|
8
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.
|
|
9
|
-
expect(servicesCost).toBe(
|
|
7
|
+
it('SHOULD compute the correct services cost for booking1 - A 2-day booking with services (that are enabled by default), without OBP and without Length of Stay Discount ', function () {
|
|
8
|
+
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking1, companyData_1.company);
|
|
9
|
+
expect(servicesCost).toBe(175);
|
|
10
10
|
});
|
|
11
|
-
it('SHOULD compute the correct accommodation cost for
|
|
12
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.
|
|
13
|
-
expect(servicesCost).toBe(
|
|
14
|
-
});
|
|
15
|
-
it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ', function () {
|
|
16
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking6, companyData_1.company);
|
|
17
|
-
expect(servicesCost).toBe(40);
|
|
18
|
-
});
|
|
19
|
-
it('SHOULD compute correct accommodation cost for case 11 - A 3-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay and breakfast', function () {
|
|
20
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking11, companyData_1.company);
|
|
21
|
-
expect(servicesCost).toBe(105);
|
|
22
|
-
});
|
|
23
|
-
it('SHOULD compute correct accommodation cost for case 12 - A 4-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay', function () {
|
|
24
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking12, companyData_1.company);
|
|
25
|
-
expect(servicesCost).toBe(320);
|
|
26
|
-
});
|
|
27
|
-
it('SHOULD compute correct accommodation cost for case 13 - A 4-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay', function () {
|
|
28
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking13, companyData_1.company);
|
|
29
|
-
expect(servicesCost).toBe(240);
|
|
30
|
-
});
|
|
31
|
-
it('SHOUlD compute correct accommodation cost for case 15 - A 2 day booking with 4 rooms services that are enabled by default and counting also the per stay services for each room that has them', function () {
|
|
32
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking15, companyData_1.company);
|
|
33
|
-
expect(servicesCost).toBe(380);
|
|
11
|
+
it('SHOULD compute the correct accommodation cost for booking2 - A 2-day booking with services (that are enabled by default), with OBP and without Length of Stay Discount ', function () {
|
|
12
|
+
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking2, companyData_1.company);
|
|
13
|
+
expect(servicesCost).toBe(75);
|
|
34
14
|
});
|
|
15
|
+
// it('SHOULD compute the correct accommodation cost for booking6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ', () => {
|
|
16
|
+
// const servicesCost = getServicesCost(booking6, company)
|
|
17
|
+
// expect(servicesCost).toBe(40)
|
|
18
|
+
// })
|
|
19
|
+
// it('SHOULD compute correct accommodation cost for booking11 - A 3-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay and breakfast', () => {
|
|
20
|
+
// const servicesCost = getServicesCost(booking11, company)
|
|
21
|
+
// expect(servicesCost).toBe(105)
|
|
22
|
+
// })
|
|
23
|
+
// it('SHOULD compute correct accommodation cost for booking12 - A 4-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay', () => {
|
|
24
|
+
// const servicesCost = getServicesCost(booking12, company)
|
|
25
|
+
// expect(servicesCost).toBe(320)
|
|
26
|
+
// })
|
|
27
|
+
// it('SHOULD compute correct accommodation cost for booking13 - A 4-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay', () => {
|
|
28
|
+
// const servicesCost = getServicesCost(booking13, company)
|
|
29
|
+
// expect(servicesCost).toBe(240)
|
|
30
|
+
// })
|
|
31
|
+
// it('SHOUlD compute correct accommodation cost for booking15 - A 2 day booking with 4 rooms services that are enabled by default and counting also the per stay services for each room that has them', () => {
|
|
32
|
+
// const servicesCost = getServicesCost(booking15, company)
|
|
33
|
+
// expect(servicesCost).toBe(15)
|
|
34
|
+
// })
|
|
35
35
|
});
|
|
36
36
|
//# sourceMappingURL=bookingsService.getServicesCost.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookingsService.getServicesCost.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getServicesCost.test.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"bookingsService.getServicesCost.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getServicesCost.test.ts"],"names":[],"mappings":";;AAAA,gEAAqE;AACrE,gEAA0D;AAC1D,sDAAoD;AAEpD,QAAQ,CAAC,iCAAiC,EAAE;IAC1C,EAAE,CAAC,uKAAuK,EAAE;QAC1K,IAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,sBAAQ,EAAE,qBAAO,CAAC,CAAA;QACvD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,yKAAyK,EAAE;QAC5K,IAAM,YAAY,GAAG,IAAA,iCAAe,EAAC,sBAAQ,EAAE,qBAAO,CAAC,CAAA;QACvD,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,iMAAiM;IACjM,4DAA4D;IAC5D,kCAAkC;IAClC,KAAK;IAEL,mMAAmM;IACnM,6DAA6D;IAC7D,mCAAmC;IACnC,KAAK;IAEL,qLAAqL;IACrL,6DAA6D;IAC7D,mCAAmC;IACnC,KAAK;IAEL,qLAAqL;IACrL,6DAA6D;IAC7D,mCAAmC;IACnC,KAAK;IAEL,gNAAgN;IAChN,6DAA6D;IAC7D,kCAAkC;IAClC,KAAK;AACP,CAAC,CAAC,CAAA"}
|
|
@@ -6,43 +6,43 @@ var bookingsService_1 = require("../bookingsService");
|
|
|
6
6
|
describe('WHEN testing .getTotalCost()', function () {
|
|
7
7
|
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 () {
|
|
8
8
|
var accommodationCost = (0, bookingsService_1.getTotalCost)(bookingData_1.booking1, companyData_1.company);
|
|
9
|
-
expect(accommodationCost).toBe(
|
|
9
|
+
expect(accommodationCost).toBe(908.08);
|
|
10
10
|
});
|
|
11
11
|
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 () {
|
|
12
12
|
var accommodationCost = (0, bookingsService_1.getTotalCost)(bookingData_1.booking2, companyData_1.company);
|
|
13
|
-
expect(accommodationCost).toBe(
|
|
14
|
-
});
|
|
15
|
-
it('SHOULD compute the correct accommodation cost for case 3 - A 2-day booking with services (that are enabled by default), without OBP and without Length of Stay Discount ',
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
it('SHOULD compute the correct accommodation cost for case 4 - A 2-day booking with services (that are enabled by default), with OBP and without Length of Stay Discount ',
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
})
|
|
23
|
-
it('SHOULD compute the correct accommodation cost for case 5 - A 3-day booking with a reduced price by OBP and by the Length of Stay Discount',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
31
|
-
it('SHOULD compute the correct accommodation cost for case 7 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range)',
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
it('SHOULD compute the correct accommodation cost for case 8 - A 2-day booking at the normal price with OBP or Length of Stay Discount, with 4 children of various age ranges ',
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
it('SHOULD compute the correct accommodation cost for case 9 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges ',
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
})
|
|
43
|
-
it('SHOULD compute the correct accommodation cost for case 9 - A 3-day booking with normal price by OBP and with Length of Stay Discount, with 4 children of various age ranges',
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
13
|
+
expect(accommodationCost).toBe(441.54);
|
|
14
|
+
});
|
|
15
|
+
// it('SHOULD compute the correct accommodation cost for case 3 - A 2-day booking with services (that are enabled by default), without OBP and without Length of Stay Discount ', () => {
|
|
16
|
+
// const accommodationCost = getAccommodationCost(booking3)
|
|
17
|
+
// expect(accommodationCost).toBe(298)
|
|
18
|
+
// })
|
|
19
|
+
// it('SHOULD compute the correct accommodation cost for case 4 - A 2-day booking with services (that are enabled by default), with OBP and without Length of Stay Discount ', () => {
|
|
20
|
+
// const accommodationCost = getTotalCost(booking4, company)
|
|
21
|
+
// expect(accommodationCost).toBe(303)
|
|
22
|
+
// })
|
|
23
|
+
// it('SHOULD compute the correct accommodation cost for case 5 - A 3-day booking with a reduced price by OBP and by the Length of Stay Discount', () => {
|
|
24
|
+
// const accommodationCost = getTotalCost(booking5, company)
|
|
25
|
+
// expect(accommodationCost).toBe(329.88599999999997)
|
|
26
|
+
// })
|
|
27
|
+
// it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ', () => {
|
|
28
|
+
// const accommodationCost = getTotalCost(booking6, company)
|
|
29
|
+
// expect(accommodationCost).toBe(381.94)
|
|
30
|
+
// })
|
|
31
|
+
// it('SHOULD compute the correct accommodation cost for case 7 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range)', () => {
|
|
32
|
+
// const accommodationCost = getTotalCost(booking7, company)
|
|
33
|
+
// expect(accommodationCost).toBe(368)
|
|
34
|
+
// })
|
|
35
|
+
// it('SHOULD compute the correct accommodation cost for case 8 - A 2-day booking at the normal price with OBP or Length of Stay Discount, with 4 children of various age ranges ', () => {
|
|
36
|
+
// const accommodationCost = getTotalCost(booking8, company)
|
|
37
|
+
// expect(accommodationCost).toBe(508)
|
|
38
|
+
// })
|
|
39
|
+
// it('SHOULD compute the correct accommodation cost for case 9 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges ', () => {
|
|
40
|
+
// const accommodationCost = getTotalCost(booking9, company)
|
|
41
|
+
// expect(accommodationCost).toBe(388.79999999999995)
|
|
42
|
+
// })
|
|
43
|
+
// it('SHOULD compute the correct accommodation cost for case 9 - A 3-day booking with normal price by OBP and with Length of Stay Discount, with 4 children of various age ranges', () => {
|
|
44
|
+
// const accommodationCost = getTotalCost(booking10, company)
|
|
45
|
+
// expect(accommodationCost).toBe(681.54)
|
|
46
|
+
// })
|
|
47
47
|
});
|
|
48
48
|
//# sourceMappingURL=bookingsService.getTotalCost.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bookingsService.getTotalCost.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getTotalCost.test.ts"],"names":[],"mappings":";;AAAA,gEAWyC;AACzC,gEAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"bookingsService.getTotalCost.test.js","sourceRoot":"","sources":["../../../../src/services/bookingService/__tests__/bookingsService.getTotalCost.test.ts"],"names":[],"mappings":";;AAAA,gEAWyC;AACzC,gEAA0D;AAC1D,sDAAiD;AAEjD,QAAQ,CAAC,8BAA8B,EAAE;IACvC,EAAE,CAAC,uIAAuI,EAAE;QAC1I,IAAM,iBAAiB,GAAG,IAAA,8BAAY,EAAC,sBAAQ,EAAE,qBAAO,CAAC,CAAA;QACzD,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4IAA4I,EAAE;QAC/I,IAAM,iBAAiB,GAAG,IAAA,8BAAY,EAAC,sBAAQ,EAAE,qBAAO,CAAC,CAAA;QACzD,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;IAEF,yLAAyL;IACzL,6DAA6D;IAC7D,wCAAwC;IACxC,KAAK;IAEL,sLAAsL;IACtL,8DAA8D;IAC9D,wCAAwC;IACxC,KAAK;IAEL,0JAA0J;IAC1J,8DAA8D;IAC9D,uDAAuD;IACvD,KAAK;IAEL,+LAA+L;IAC/L,8DAA8D;IAC9D,2CAA2C;IAC3C,KAAK;IAEL,gMAAgM;IAChM,8DAA8D;IAC9D,wCAAwC;IACxC,KAAK;IAEL,2LAA2L;IAC3L,8DAA8D;IAC9D,wCAAwC;IACxC,KAAK;IAEL,mMAAmM;IACnM,8DAA8D;IAC9D,uDAAuD;IACvD,KAAK;IAEL,4LAA4L;IAC5L,+DAA+D;IAC/D,2CAA2C;IAC3C,KAAK;AACP,CAAC,CAAC,CAAA"}
|
package/lib/services/bookingService/__tests__/bookingsService.manualComputeTotalCost.test.js
CHANGED
|
@@ -7,7 +7,7 @@ var companyData_1 = require("../../../testingData/companyData");
|
|
|
7
7
|
(0, node_test_1.describe)('WHEN computing the total cost of a booking', function () {
|
|
8
8
|
it('SHOULD compute the correct booking cost for case 1 - A 2 day booking at the normal price without OBP or Length of stay Discount', function () {
|
|
9
9
|
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking1);
|
|
10
|
-
expect(accommodationCost).toBe(
|
|
10
|
+
expect(accommodationCost).toBe(894);
|
|
11
11
|
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking1);
|
|
12
12
|
expect(breakfastCost).toBe(0);
|
|
13
13
|
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking1);
|
|
@@ -15,15 +15,15 @@ var companyData_1 = require("../../../testingData/companyData");
|
|
|
15
15
|
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking1);
|
|
16
16
|
expect(childrenTourismTax).toBe(0);
|
|
17
17
|
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking1, companyData_1.company);
|
|
18
|
-
expect(servicesCost).toBe(
|
|
18
|
+
expect(servicesCost).toBe(175);
|
|
19
19
|
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking1, companyData_1.company);
|
|
20
|
-
expect(lengthOfStayDiscount).toBe(-
|
|
20
|
+
expect(lengthOfStayDiscount).toBe(-160.92);
|
|
21
21
|
var bookingTotalCost = accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
22
|
-
expect(bookingTotalCost).toBe(
|
|
22
|
+
expect(bookingTotalCost).toBe(908.08);
|
|
23
23
|
});
|
|
24
24
|
it('SHOULD compute the correct booking cost for case 2 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount', function () {
|
|
25
25
|
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking2);
|
|
26
|
-
expect(accommodationCost).toBe(
|
|
26
|
+
expect(accommodationCost).toBe(447);
|
|
27
27
|
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking2);
|
|
28
28
|
expect(breakfastCost).toBe(0);
|
|
29
29
|
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking2);
|
|
@@ -31,155 +31,158 @@ var companyData_1 = require("../../../testingData/companyData");
|
|
|
31
31
|
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking2);
|
|
32
32
|
expect(childrenTourismTax).toBe(0);
|
|
33
33
|
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking2, companyData_1.company);
|
|
34
|
-
expect(servicesCost).toBe(
|
|
34
|
+
expect(servicesCost).toBe(75);
|
|
35
35
|
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking2, companyData_1.company);
|
|
36
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
37
|
-
var bookingTotalCost = accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
38
|
-
expect(bookingTotalCost).toBe(248);
|
|
39
|
-
});
|
|
40
|
-
it('SHOULD compute the correct accommodation cost for case 3 - A 2-day booking with services (that are enabled by default), without OBP and without Length of Stay Discount ', function () {
|
|
41
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking3);
|
|
42
|
-
expect(accommodationCost).toBe(298);
|
|
43
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking3);
|
|
44
|
-
expect(breakfastCost).toBe(0);
|
|
45
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking3);
|
|
46
|
-
expect(childrenCost).toBe(0);
|
|
47
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking3);
|
|
48
|
-
expect(childrenTourismTax).toBe(0);
|
|
49
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking3, companyData_1.company);
|
|
50
|
-
expect(servicesCost).toBe(65);
|
|
51
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking3, companyData_1.company);
|
|
52
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
53
|
-
var bookingTotalCost = accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
54
|
-
expect(bookingTotalCost).toBe(363);
|
|
55
|
-
});
|
|
56
|
-
it('SHOULD compute the correct accommodation cost for case 4 - A 2-day booking with services (that are enabled by default), with OBP and without Length of Stay Discount ', function () {
|
|
57
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking4);
|
|
58
|
-
expect(accommodationCost).toBe(248);
|
|
59
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking4);
|
|
60
|
-
expect(breakfastCost).toBe(0);
|
|
61
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking4);
|
|
62
|
-
expect(childrenCost).toBe(0);
|
|
63
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking4);
|
|
64
|
-
expect(childrenTourismTax).toBe(0);
|
|
65
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking4, companyData_1.company);
|
|
66
|
-
expect(servicesCost).toBe(55);
|
|
67
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking4, companyData_1.company);
|
|
68
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
69
|
-
var bookingTotalCost = accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
70
|
-
expect(bookingTotalCost).toBe(303);
|
|
71
|
-
});
|
|
72
|
-
it('SHOULD compute the correct accommodation cost for case 5 - A 3-day booking with a reduced price by OBP and by the Length of Stay Discount', function () {
|
|
73
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking5);
|
|
74
|
-
expect(accommodationCost).toBe(402.29999999999995);
|
|
75
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking5);
|
|
76
|
-
expect(breakfastCost).toBe(30); // breakfast cost is included in the accommodation cost
|
|
77
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking5);
|
|
78
|
-
expect(childrenCost).toBe(0);
|
|
79
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking5);
|
|
80
|
-
expect(childrenTourismTax).toBe(0);
|
|
81
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking5, companyData_1.company);
|
|
82
|
-
expect(servicesCost).toBe(0);
|
|
83
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking5, companyData_1.company);
|
|
84
|
-
expect(lengthOfStayDiscount).toBe(-72.41399999999999);
|
|
85
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
86
|
-
expect(bookingTotalCost).toBe(329.88599999999997);
|
|
87
|
-
});
|
|
88
|
-
it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ', function () {
|
|
89
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking6);
|
|
90
|
-
expect(accommodationCost).toBe(417);
|
|
91
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking6);
|
|
92
|
-
expect(breakfastCost).toBe(90); // breakfast cost is included in the accommodation cost
|
|
93
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking6);
|
|
94
|
-
expect(childrenCost).toBe(0);
|
|
95
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking6);
|
|
96
|
-
expect(childrenTourismTax).toBe(0);
|
|
97
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking6, companyData_1.company);
|
|
98
|
-
expect(servicesCost).toBe(40);
|
|
99
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking6, companyData_1.company);
|
|
100
|
-
expect(lengthOfStayDiscount).toBe(-75.06);
|
|
101
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
102
|
-
expect(bookingTotalCost).toBe(381.94);
|
|
103
|
-
});
|
|
104
|
-
it('SHOULD compute the correct accommodation cost for case 7 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range)', function () {
|
|
105
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking7);
|
|
106
|
-
expect(accommodationCost).toBe(298);
|
|
107
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking7);
|
|
108
|
-
expect(breakfastCost).toBe(50); // breakfast cost is included in the accommodation cost
|
|
109
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking7);
|
|
110
|
-
expect(childrenCost).toBe(60);
|
|
111
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking7);
|
|
112
|
-
expect(childrenTourismTax).toBe(10);
|
|
113
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking7, companyData_1.company);
|
|
114
|
-
expect(servicesCost).toBe(0);
|
|
115
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking7, companyData_1.company);
|
|
116
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
117
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
118
|
-
expect(bookingTotalCost).toBe(368);
|
|
119
|
-
});
|
|
120
|
-
it('SHOULD compute the correct accommodation cost for case 8 - A 2-day booking at the normal price with OBP or Length of Stay Discount, with 4 children of various age ranges ', function () {
|
|
121
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking8);
|
|
122
|
-
expect(accommodationCost).toBe(298);
|
|
123
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking8);
|
|
124
|
-
expect(breakfastCost).toBe(50);
|
|
125
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking8);
|
|
126
|
-
expect(childrenCost).toBe(180);
|
|
127
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking8);
|
|
128
|
-
expect(childrenTourismTax).toBe(30);
|
|
129
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking8, companyData_1.company);
|
|
130
|
-
expect(servicesCost).toBe(0);
|
|
131
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking8, companyData_1.company);
|
|
132
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
133
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
134
|
-
expect(bookingTotalCost).toBe(508);
|
|
135
|
-
});
|
|
136
|
-
it('SHOULD compute the correct accommodation cost for case 9 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges ', function () {
|
|
137
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking9);
|
|
138
|
-
expect(accommodationCost).toBe(178.79999999999998);
|
|
139
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking9);
|
|
140
|
-
expect(breakfastCost).toBe(0);
|
|
141
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking9);
|
|
142
|
-
expect(childrenCost).toBe(160);
|
|
143
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking9);
|
|
144
|
-
expect(childrenTourismTax).toBe(50);
|
|
145
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking9, companyData_1.company);
|
|
146
|
-
expect(servicesCost).toBe(0);
|
|
147
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking9, companyData_1.company);
|
|
148
|
-
expect(lengthOfStayDiscount).toBe(0);
|
|
149
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
150
|
-
expect(bookingTotalCost).toBe(388.79999999999995);
|
|
151
|
-
});
|
|
152
|
-
it('SHOULD compute the correct accommodation cost for case 10 - A 3-day booking with normal price by OBP and with Length of Stay Discount, with 4 children of various age ranges', function () {
|
|
153
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking10);
|
|
154
|
-
expect(accommodationCost).toBe(447);
|
|
155
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking10);
|
|
156
|
-
expect(breakfastCost).toBe(0);
|
|
157
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking10);
|
|
158
|
-
expect(childrenCost).toBe(240);
|
|
159
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking10);
|
|
160
|
-
expect(childrenTourismTax).toBe(75);
|
|
161
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking10, companyData_1.company);
|
|
162
|
-
expect(servicesCost).toBe(0);
|
|
163
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking10, companyData_1.company);
|
|
164
|
-
expect(lengthOfStayDiscount).toBe(-80.46);
|
|
165
|
-
var bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
166
|
-
expect(bookingTotalCost).toBe(681.54);
|
|
167
|
-
});
|
|
168
|
-
it('SHOULD compute correct accommodation cost for case 11 - A 3-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay and breakfast', function () {
|
|
169
|
-
var accommodationCost = (0, bookingsService_1.getAccommodationCost)(bookingData_1.booking11);
|
|
170
|
-
expect(accommodationCost).toBe(447);
|
|
171
|
-
var breakfastCost = (0, bookingsService_1.getBreakfastCost)(bookingData_1.booking11);
|
|
172
|
-
expect(breakfastCost).toBe(120);
|
|
173
|
-
var childrenCost = (0, bookingsService_1.getChildrenCost)(bookingData_1.booking11);
|
|
174
|
-
expect(childrenCost).toBe(0);
|
|
175
|
-
var childrenTourismTax = (0, bookingsService_1.getChildrenTourismTaxCost)(bookingData_1.booking11);
|
|
176
|
-
expect(childrenTourismTax).toBe(0);
|
|
177
|
-
var servicesCost = (0, bookingsService_1.getServicesCost)(bookingData_1.booking11, companyData_1.company);
|
|
178
|
-
expect(servicesCost).toBe(105);
|
|
179
|
-
var lengthOfStayDiscount = (0, bookingsService_1.getLengthOfStayDiscount)(bookingData_1.booking11, companyData_1.company);
|
|
180
36
|
expect(lengthOfStayDiscount).toBe(-80.46);
|
|
181
37
|
var bookingTotalCost = accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount;
|
|
182
|
-
expect(bookingTotalCost).toBe(
|
|
38
|
+
expect(bookingTotalCost).toBe(441.54);
|
|
183
39
|
});
|
|
40
|
+
// it('SHOULD compute the correct accommodation cost for case 3 - A 2-day booking with services (that are enabled by default), without OBP and without Length of Stay Discount ', () => {
|
|
41
|
+
// const accommodationCost = getAccommodationCost(booking3)
|
|
42
|
+
// expect(accommodationCost).toBe(298)
|
|
43
|
+
// const breakfastCost = getBreakfastCost(booking3)
|
|
44
|
+
// expect(breakfastCost).toBe(0)
|
|
45
|
+
// const childrenCost = getChildrenCost(booking3)
|
|
46
|
+
// expect(childrenCost).toBe(0)
|
|
47
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking3)
|
|
48
|
+
// expect(childrenTourismTax).toBe(0)
|
|
49
|
+
// const servicesCost = getServicesCost(booking3, company)
|
|
50
|
+
// expect(servicesCost).toBe(65)
|
|
51
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking3, company)
|
|
52
|
+
// expect(lengthOfStayDiscount).toBe(0)
|
|
53
|
+
// const bookingTotalCost =
|
|
54
|
+
// accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
55
|
+
// expect(bookingTotalCost).toBe(363)
|
|
56
|
+
// })
|
|
57
|
+
// it('SHOULD compute the correct accommodation cost for case 4 - A 2-day booking with services (that are enabled by default), with OBP and without Length of Stay Discount ', () => {
|
|
58
|
+
// const accommodationCost = getAccommodationCost(booking4)
|
|
59
|
+
// expect(accommodationCost).toBe(248)
|
|
60
|
+
// const breakfastCost = getBreakfastCost(booking4)
|
|
61
|
+
// expect(breakfastCost).toBe(0)
|
|
62
|
+
// const childrenCost = getChildrenCost(booking4)
|
|
63
|
+
// expect(childrenCost).toBe(0)
|
|
64
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking4)
|
|
65
|
+
// expect(childrenTourismTax).toBe(0)
|
|
66
|
+
// const servicesCost = getServicesCost(booking4, company)
|
|
67
|
+
// expect(servicesCost).toBe(55)
|
|
68
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking4, company)
|
|
69
|
+
// expect(lengthOfStayDiscount).toBe(0)
|
|
70
|
+
// const bookingTotalCost =
|
|
71
|
+
// accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
72
|
+
// expect(bookingTotalCost).toBe(303)
|
|
73
|
+
// })
|
|
74
|
+
// it('SHOULD compute the correct accommodation cost for case 5 - A 3-day booking with a reduced price by OBP and by the Length of Stay Discount', () => {
|
|
75
|
+
// const accommodationCost = getAccommodationCost(booking5)
|
|
76
|
+
// expect(accommodationCost).toBe(402.29999999999995)
|
|
77
|
+
// const breakfastCost = getBreakfastCost(booking5)
|
|
78
|
+
// expect(breakfastCost).toBe(30) // breakfast cost is included in the accommodation cost
|
|
79
|
+
// const childrenCost = getChildrenCost(booking5)
|
|
80
|
+
// expect(childrenCost).toBe(0)
|
|
81
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking5)
|
|
82
|
+
// expect(childrenTourismTax).toBe(0)
|
|
83
|
+
// const servicesCost = getServicesCost(booking5, company)
|
|
84
|
+
// expect(servicesCost).toBe(0)
|
|
85
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking5, company)
|
|
86
|
+
// expect(lengthOfStayDiscount).toBe(-72.41399999999999)
|
|
87
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
88
|
+
// expect(bookingTotalCost).toBe(329.88599999999997)
|
|
89
|
+
// })
|
|
90
|
+
// it('SHOULD compute the correct accommodation cost for case 6 - A 3-day booking with services (enabled by default), with a reduced price by OBP and by the Length of Stay Discount ', () => {
|
|
91
|
+
// const accommodationCost = getAccommodationCost(booking6)
|
|
92
|
+
// expect(accommodationCost).toBe(417)
|
|
93
|
+
// const breakfastCost = getBreakfastCost(booking6)
|
|
94
|
+
// expect(breakfastCost).toBe(90) // breakfast cost is included in the accommodation cost
|
|
95
|
+
// const childrenCost = getChildrenCost(booking6)
|
|
96
|
+
// expect(childrenCost).toBe(0)
|
|
97
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking6)
|
|
98
|
+
// expect(childrenTourismTax).toBe(0)
|
|
99
|
+
// const servicesCost = getServicesCost(booking6, company)
|
|
100
|
+
// expect(servicesCost).toBe(40)
|
|
101
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking6, company)
|
|
102
|
+
// expect(lengthOfStayDiscount).toBe(-75.06)
|
|
103
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
104
|
+
// expect(bookingTotalCost).toBe(381.94)
|
|
105
|
+
// })
|
|
106
|
+
// it('SHOULD compute the correct accommodation cost for case 7 - A 2-day booking at the normal price without OBP or Length of Stay Discount, with 1 child aged 5 years (0 - 10 range)', () => {
|
|
107
|
+
// const accommodationCost = getAccommodationCost(booking7)
|
|
108
|
+
// expect(accommodationCost).toBe(298)
|
|
109
|
+
// const breakfastCost = getBreakfastCost(booking7)
|
|
110
|
+
// expect(breakfastCost).toBe(50) // breakfast cost is included in the accommodation cost
|
|
111
|
+
// const childrenCost = getChildrenCost(booking7)
|
|
112
|
+
// expect(childrenCost).toBe(60)
|
|
113
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking7)
|
|
114
|
+
// expect(childrenTourismTax).toBe(10)
|
|
115
|
+
// const servicesCost = getServicesCost(booking7, company)
|
|
116
|
+
// expect(servicesCost).toBe(0)
|
|
117
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking7, company)
|
|
118
|
+
// expect(lengthOfStayDiscount).toBe(0)
|
|
119
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
120
|
+
// expect(bookingTotalCost).toBe(368)
|
|
121
|
+
// })
|
|
122
|
+
// it('SHOULD compute the correct accommodation cost for case 8 - A 2-day booking at the normal price with OBP or Length of Stay Discount, with 4 children of various age ranges ', () => {
|
|
123
|
+
// const accommodationCost = getAccommodationCost(booking8)
|
|
124
|
+
// expect(accommodationCost).toBe(298)
|
|
125
|
+
// const breakfastCost = getBreakfastCost(booking8)
|
|
126
|
+
// expect(breakfastCost).toBe(50)
|
|
127
|
+
// const childrenCost = getChildrenCost(booking8)
|
|
128
|
+
// expect(childrenCost).toBe(180)
|
|
129
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking8)
|
|
130
|
+
// expect(childrenTourismTax).toBe(30)
|
|
131
|
+
// const servicesCost = getServicesCost(booking8, company)
|
|
132
|
+
// expect(servicesCost).toBe(0)
|
|
133
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking8, company)
|
|
134
|
+
// expect(lengthOfStayDiscount).toBe(0)
|
|
135
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
136
|
+
// expect(bookingTotalCost).toBe(508)
|
|
137
|
+
// })
|
|
138
|
+
// it('SHOULD compute the correct accommodation cost for case 9 - A 2-day booking with a reduced price by OBP and without Length of Stay Discount, with 4 children of various age ranges ', () => {
|
|
139
|
+
// const accommodationCost = getAccommodationCost(booking9)
|
|
140
|
+
// expect(accommodationCost).toBe(178.79999999999998)
|
|
141
|
+
// const breakfastCost = getBreakfastCost(booking9)
|
|
142
|
+
// expect(breakfastCost).toBe(0)
|
|
143
|
+
// const childrenCost = getChildrenCost(booking9)
|
|
144
|
+
// expect(childrenCost).toBe(160)
|
|
145
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking9)
|
|
146
|
+
// expect(childrenTourismTax).toBe(50)
|
|
147
|
+
// const servicesCost = getServicesCost(booking9, company)
|
|
148
|
+
// expect(servicesCost).toBe(0)
|
|
149
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking9, company)
|
|
150
|
+
// expect(lengthOfStayDiscount).toBe(0)
|
|
151
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
152
|
+
// expect(bookingTotalCost).toBe(388.79999999999995)
|
|
153
|
+
// })
|
|
154
|
+
// it('SHOULD compute the correct accommodation cost for case 10 - A 3-day booking with normal price by OBP and with Length of Stay Discount, with 4 children of various age ranges', () => {
|
|
155
|
+
// const accommodationCost = getAccommodationCost(booking10)
|
|
156
|
+
// expect(accommodationCost).toBe(447)
|
|
157
|
+
// const breakfastCost = getBreakfastCost(booking10)
|
|
158
|
+
// expect(breakfastCost).toBe(0)
|
|
159
|
+
// const childrenCost = getChildrenCost(booking10)
|
|
160
|
+
// expect(childrenCost).toBe(240)
|
|
161
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking10)
|
|
162
|
+
// expect(childrenTourismTax).toBe(75)
|
|
163
|
+
// const servicesCost = getServicesCost(booking10, company)
|
|
164
|
+
// expect(servicesCost).toBe(0)
|
|
165
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking10, company)
|
|
166
|
+
// expect(lengthOfStayDiscount).toBe(-80.46)
|
|
167
|
+
// const bookingTotalCost = accommodationCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
168
|
+
// expect(bookingTotalCost).toBe(681.54)
|
|
169
|
+
// })
|
|
170
|
+
// it('SHOULD compute correct accommodation cost for case 11 - A 3-day booking with services that are enabled by default and are seasonal between 2 seasons Extended stay and breakfast', () => {
|
|
171
|
+
// const accommodationCost = getAccommodationCost(booking11)
|
|
172
|
+
// expect(accommodationCost).toBe(447)
|
|
173
|
+
// const breakfastCost = getBreakfastCost(booking11)
|
|
174
|
+
// expect(breakfastCost).toBe(120)
|
|
175
|
+
// const childrenCost = getChildrenCost(booking11)
|
|
176
|
+
// expect(childrenCost).toBe(0)
|
|
177
|
+
// const childrenTourismTax = getChildrenTourismTaxCost(booking11)
|
|
178
|
+
// expect(childrenTourismTax).toBe(0)
|
|
179
|
+
// const servicesCost = getServicesCost(booking11, company)
|
|
180
|
+
// expect(servicesCost).toBe(105)
|
|
181
|
+
// const lengthOfStayDiscount = getLengthOfStayDiscount(booking11, company)
|
|
182
|
+
// expect(lengthOfStayDiscount).toBe(-80.46)
|
|
183
|
+
// const bookingTotalCost =
|
|
184
|
+
// accommodationCost + breakfastCost + childrenCost + childrenTourismTax + servicesCost + lengthOfStayDiscount
|
|
185
|
+
// expect(bookingTotalCost).toBe(591.54)
|
|
186
|
+
// })
|
|
184
187
|
});
|
|
185
188
|
//# sourceMappingURL=bookingsService.manualComputeTotalCost.test.js.map
|