@defra-fish/sales-api-service 1.41.0-rc.0 → 1.41.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defra-fish/sales-api-service",
|
|
3
|
-
"version": "1.41.0
|
|
3
|
+
"version": "1.41.0",
|
|
4
4
|
"description": "Rod Licensing Sales API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@defra-fish/business-rules-lib": "1.41.0
|
|
39
|
-
"@defra-fish/connectors-lib": "1.41.0
|
|
40
|
-
"@defra-fish/dynamics-lib": "1.41.0
|
|
38
|
+
"@defra-fish/business-rules-lib": "1.41.0",
|
|
39
|
+
"@defra-fish/connectors-lib": "1.41.0",
|
|
40
|
+
"@defra-fish/dynamics-lib": "1.41.0",
|
|
41
41
|
"@hapi/boom": "^9.1.2",
|
|
42
42
|
"@hapi/hapi": "^20.1.3",
|
|
43
43
|
"@hapi/inert": "^6.0.3",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"moment-timezone": "^0.5.34",
|
|
53
53
|
"uuid": "^8.3.2"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e7a7d81581eae902ae3249b6d950377bb17960a2"
|
|
56
56
|
}
|
|
@@ -141,6 +141,12 @@ describe('permissions service', () => {
|
|
|
141
141
|
expect(endDate).toEqual(expectedEndDate.toISOString())
|
|
142
142
|
})
|
|
143
143
|
})
|
|
144
|
+
|
|
145
|
+
it('returns correct end date on leap year', async () => {
|
|
146
|
+
const startDate = moment('2024-02-29')
|
|
147
|
+
const endDate = await calculateEndDate({ permitId: 'e11b34a0-0c66-e611-80dc-c4346bad0190', startDate })
|
|
148
|
+
expect(endDate).toBe('2025-02-28T23:59:59.999Z')
|
|
149
|
+
})
|
|
144
150
|
})
|
|
145
151
|
|
|
146
152
|
describe('sequence generator', () => {
|
|
@@ -63,7 +63,7 @@ export const calculateEndDateMoment = async ({ permitId, startDate }) => {
|
|
|
63
63
|
const permit = await getReferenceDataForEntityAndId(Permit, permitId)
|
|
64
64
|
const duration = moment.duration(`P${permit.durationMagnitude}${permit.durationDesignator.description}`)
|
|
65
65
|
if (permit.durationMagnitude === 12 && permit.durationDesignator.description === 'M') {
|
|
66
|
-
return moment(startDate).tz(SERVICE_LOCAL_TIME).
|
|
66
|
+
return moment(startDate).tz(SERVICE_LOCAL_TIME).subtract(1, 'day').endOf('day').add(duration)
|
|
67
67
|
}
|
|
68
68
|
return moment(startDate).add(duration)
|
|
69
69
|
}
|