@defra-fish/business-rules-lib 1.30.0-rc.9 → 1.30.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/business-rules-lib",
|
|
3
|
-
"version": "1.30.0
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Shared business rules for the rod licensing digital services",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"moment": "^2.29.1",
|
|
38
38
|
"uuid": "^8.3.2"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f5dacdf20e2841487fa641de4eed2bae64e6c205"
|
|
41
41
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as contactValidation from './validators/contact.validators.js'
|
|
2
2
|
import * as permissionValidation from './validators/permission.validators.js'
|
|
3
3
|
export * from './util/ages.js'
|
|
4
|
+
export * from './util/permissions.js'
|
|
4
5
|
export * from './constants.js'
|
|
5
6
|
|
|
6
7
|
export const validation = {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { getPermissionCost } from '../permissions'
|
|
2
|
+
|
|
3
|
+
describe('permissions helper', () => {
|
|
4
|
+
it.each`
|
|
5
|
+
desc | expectedCost | permission
|
|
6
|
+
${'starting before switch date'} | ${1000} | ${{ startDate: '2023-03-30', permit: { cost: 1000, newCost: 2000 } }}
|
|
7
|
+
${'starting on switch date'} | ${90} | ${{ startDate: '2023-04-01', permit: { cost: 70, newCost: 90 } }}
|
|
8
|
+
${'starting after switch date'} | ${130} | ${{ startDate: '2023-04-02', permit: { cost: 110, newCost: 130 } }}
|
|
9
|
+
${'starting after switch date where price has reduced'} | ${50} | ${{ startDate: '2023-04-02', permit: { cost: 90, newCost: 50 } }}
|
|
10
|
+
`('gets cost of permission $desc', ({ expectedCost, permission }) => {
|
|
11
|
+
permission.permit.newCostStartDate = '2023-04-01'
|
|
12
|
+
const cost = getPermissionCost(permission)
|
|
13
|
+
expect(cost).toBe(expectedCost)
|
|
14
|
+
})
|
|
15
|
+
})
|