ffc-pay-schemes 1.0.6 → 1.0.7
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/README.md +2 -0
- package/app/constants/pillars.js +1 -0
- package/app/constants/schemes.js +1 -1
- package/app/get-scheme-id-from-pillar.js +10 -0
- package/index.js +2 -0
- package/package.json +1 -1
- package/test/unit/get-scheme-id-from-pillar.test.js +52 -0
- package/test-output/cobertura-coverage.xml +31 -8
- package/test-output/junit.xml +282 -272
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ap.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-admin.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/ar-irregular.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/account-codes/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/delivery-bodies.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/description-codes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/fund-codes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +5 -2
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-batch-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-ids.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/scheme-names.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-not-requiring-ppas.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes-providing-account-values.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/schemes.js.html +2 -2
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/source-systems.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/unknown.js.html +2 -2
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-default-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-es-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-imps-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/create-standard-scheme-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/index.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-invoice-number/use-invoice-number-as-is.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-default-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/create-split-invoice-number/index.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/bps-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cohtc-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/cs-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/default-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/delinked-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/index.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/lump-sums-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/sfi-frps-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-account-code-map/vet-visits-map.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-batch-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-id-from-pillar.js.html +115 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-id-from-source-system.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-ids.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-name-from-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-names.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-scheme-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-schemes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/get-source-system-from-scheme-id.js.html +5 -5
- package/test-output/lcov-report/ffc-pay-schemes/app/get-source-systems.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/index.html +23 -8
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-does-not-require-ppas.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-provides-accounting-values.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/index.html +5 -5
- package/test-output/lcov-report/ffc-pay-schemes/index.js.html +10 -4
- package/test-output/lcov-report/index.html +13 -13
- package/test-output/lcov.info +34 -12
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@ const {
|
|
|
18
18
|
createSplitInvoiceNumber,
|
|
19
19
|
getAccountCodeMap,
|
|
20
20
|
getSchemeBatchProperties,
|
|
21
|
+
getSchemeIdFromPillar,
|
|
21
22
|
getSchemeIdFromSourceSystem,
|
|
22
23
|
getSchemeIds,
|
|
23
24
|
getSchemeNameFromSchemeId,
|
|
@@ -35,6 +36,7 @@ const {
|
|
|
35
36
|
- `createSplitInvoiceNumber(paymentRequest)` creates a split invoice number for a given `paymentRequest`.
|
|
36
37
|
- `getAccountCodeMap(schemeId)` returns the account code mapping used for a given `schemeId`.
|
|
37
38
|
- `getSchemeBatchProperties(schemeId)` returns the batch processing properties for a given `schemeId`.
|
|
39
|
+
- `getSchemeIdFromPillar(pillar)` returns the scheme ID for a given `pillar`.
|
|
38
40
|
- `getSchemeIdFromSourceSystem(sourceSystem)` returns the scheme ID for a given `sourceSystem`.
|
|
39
41
|
- `getSchemeIds()` returns all supported scheme IDs.
|
|
40
42
|
- `getSchemeNameFromSchemeId(schemeId)` returns the scheme name for a given `schemeId`.
|
package/app/constants/pillars.js
CHANGED
package/app/constants/schemes.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const { getSchemes } = require('./get-schemes')
|
|
2
|
+
|
|
3
|
+
const getSchemeIdFromPillar = (pillar) => {
|
|
4
|
+
const matchingScheme = getSchemes().find((scheme) => scheme.pillar === pillar)
|
|
5
|
+
return matchingScheme?.schemeId
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
getSchemeIdFromPillar
|
|
10
|
+
}
|
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ const { createInvoiceNumber } = require('./app/create-invoice-number')
|
|
|
2
2
|
const { createSplitInvoiceNumber } = require('./app/create-split-invoice-number')
|
|
3
3
|
const { getAccountCodeMap } = require('./app/get-account-code-map')
|
|
4
4
|
const { getSchemeBatchProperties } = require('./app/get-scheme-batch-properties')
|
|
5
|
+
const { getSchemeIdFromPillar } = require('./app/get-scheme-id-from-pillar')
|
|
5
6
|
const { getSchemeIdFromSourceSystem } = require('./app/get-scheme-id-from-source-system')
|
|
6
7
|
const { getSchemeIds } = require('./app/get-scheme-ids')
|
|
7
8
|
const { getSchemeNameFromSchemeId } = require('./app/get-scheme-name-from-scheme-id')
|
|
@@ -18,6 +19,7 @@ module.exports = {
|
|
|
18
19
|
createSplitInvoiceNumber,
|
|
19
20
|
getAccountCodeMap,
|
|
20
21
|
getSchemeBatchProperties,
|
|
22
|
+
getSchemeIdFromPillar,
|
|
21
23
|
getSchemeIdFromSourceSystem,
|
|
22
24
|
getSchemeIds,
|
|
23
25
|
getSchemeNameFromSchemeId,
|
package/package.json
CHANGED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
jest.mock('../../app/get-schemes', () => ({
|
|
2
|
+
getSchemes: jest.fn()
|
|
3
|
+
}))
|
|
4
|
+
|
|
5
|
+
const { getSchemes } = require('../../app/get-schemes')
|
|
6
|
+
const { getSchemeIdFromPillar } = require('../../app/get-scheme-id-from-pillar')
|
|
7
|
+
|
|
8
|
+
describe('getSchemeIdFromPillar', () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
jest.clearAllMocks()
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('returns the schemeId for a matching pillar', () => {
|
|
14
|
+
getSchemes.mockReturnValue([
|
|
15
|
+
{
|
|
16
|
+
schemeId: 1,
|
|
17
|
+
schemeName: 'Example Scheme',
|
|
18
|
+
sourceSystem: 'Example Source',
|
|
19
|
+
pillar: 'Example Pillar'
|
|
20
|
+
}
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
expect(getSchemeIdFromPillar('Example Pillar')).toBe(1)
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('returns undefined when the pillar is not found', () => {
|
|
27
|
+
getSchemes.mockReturnValue([
|
|
28
|
+
{
|
|
29
|
+
schemeId: 1,
|
|
30
|
+
schemeName: 'Example Scheme',
|
|
31
|
+
sourceSystem: 'Example Source',
|
|
32
|
+
pillar: 'Example Pillar'
|
|
33
|
+
}
|
|
34
|
+
])
|
|
35
|
+
|
|
36
|
+
expect(getSchemeIdFromPillar('Not a real pillar')).toBeUndefined()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('returns undefined when no schemes are available', () => {
|
|
40
|
+
getSchemes.mockReturnValue([])
|
|
41
|
+
|
|
42
|
+
expect(getSchemeIdFromPillar('Not a real source')).toBeUndefined()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('gets schemes before searching for the pillar', () => {
|
|
46
|
+
getSchemes.mockReturnValue([])
|
|
47
|
+
|
|
48
|
+
getSchemeIdFromPillar('Not a real source')
|
|
49
|
+
|
|
50
|
+
expect(getSchemes).toHaveBeenCalledTimes(1)
|
|
51
|
+
})
|
|
52
|
+
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" ?>
|
|
2
2
|
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
|
|
3
|
-
<coverage lines-valid="
|
|
3
|
+
<coverage lines-valid="243" lines-covered="227" line-rate="0.9340999999999999" branches-valid="54" branches-covered="54" branch-rate="1" timestamp="1788362739771" complexity="0" version="0.1">
|
|
4
4
|
<sources>
|
|
5
5
|
<source>/home/samplackett/ffc-pay-schemes</source>
|
|
6
6
|
</sources>
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
<line number="12" hits="0" branch="false"/>
|
|
26
26
|
<line number="13" hits="0" branch="false"/>
|
|
27
27
|
<line number="14" hits="0" branch="false"/>
|
|
28
|
-
<line number="
|
|
28
|
+
<line number="15" hits="0" branch="false"/>
|
|
29
|
+
<line number="17" hits="0" branch="false"/>
|
|
29
30
|
</lines>
|
|
30
31
|
</class>
|
|
31
32
|
</classes>
|
|
@@ -52,6 +53,27 @@
|
|
|
52
53
|
<line number="7" hits="1" branch="false"/>
|
|
53
54
|
</lines>
|
|
54
55
|
</class>
|
|
56
|
+
<class name="get-scheme-id-from-pillar.js" filename="app/get-scheme-id-from-pillar.js" line-rate="1" branch-rate="1">
|
|
57
|
+
<methods>
|
|
58
|
+
<method name="(anonymous_0)" hits="4" signature="()V">
|
|
59
|
+
<lines>
|
|
60
|
+
<line number="3" hits="4"/>
|
|
61
|
+
</lines>
|
|
62
|
+
</method>
|
|
63
|
+
<method name="(anonymous_1)" hits="2" signature="()V">
|
|
64
|
+
<lines>
|
|
65
|
+
<line number="4" hits="2"/>
|
|
66
|
+
</lines>
|
|
67
|
+
</method>
|
|
68
|
+
</methods>
|
|
69
|
+
<lines>
|
|
70
|
+
<line number="1" hits="1" branch="false"/>
|
|
71
|
+
<line number="3" hits="1" branch="false"/>
|
|
72
|
+
<line number="4" hits="4" branch="false"/>
|
|
73
|
+
<line number="5" hits="4" branch="false"/>
|
|
74
|
+
<line number="8" hits="1" branch="false"/>
|
|
75
|
+
</lines>
|
|
76
|
+
</class>
|
|
55
77
|
<class name="get-scheme-id-from-source-system.js" filename="app/get-scheme-id-from-source-system.js" line-rate="1" branch-rate="1">
|
|
56
78
|
<methods>
|
|
57
79
|
<method name="(anonymous_0)" hits="4" signature="()V">
|
|
@@ -191,21 +213,22 @@
|
|
|
191
213
|
<methods>
|
|
192
214
|
<method name="(anonymous_0)" hits="4" signature="()V">
|
|
193
215
|
<lines>
|
|
194
|
-
<line number="
|
|
216
|
+
<line number="4" hits="4"/>
|
|
195
217
|
</lines>
|
|
196
218
|
</method>
|
|
197
219
|
<method name="(anonymous_1)" hits="2" signature="()V">
|
|
198
220
|
<lines>
|
|
199
|
-
<line number="
|
|
221
|
+
<line number="5" hits="2"/>
|
|
200
222
|
</lines>
|
|
201
223
|
</method>
|
|
202
224
|
</methods>
|
|
203
225
|
<lines>
|
|
204
226
|
<line number="1" hits="1" branch="false"/>
|
|
205
|
-
<line number="
|
|
206
|
-
<line number="4" hits="
|
|
227
|
+
<line number="2" hits="1" branch="false"/>
|
|
228
|
+
<line number="4" hits="1" branch="false"/>
|
|
207
229
|
<line number="5" hits="4" branch="false"/>
|
|
208
|
-
<line number="
|
|
230
|
+
<line number="6" hits="4" branch="true" condition-coverage="100% (2/2)"/>
|
|
231
|
+
<line number="9" hits="1" branch="false"/>
|
|
209
232
|
</lines>
|
|
210
233
|
</class>
|
|
211
234
|
<class name="get-source-systems.js" filename="app/get-source-systems.js" line-rate="1" branch-rate="1">
|
|
@@ -346,7 +369,7 @@
|
|
|
346
369
|
<methods>
|
|
347
370
|
</methods>
|
|
348
371
|
<lines>
|
|
349
|
-
<line number="1" hits="
|
|
372
|
+
<line number="1" hits="2" branch="false"/>
|
|
350
373
|
</lines>
|
|
351
374
|
</class>
|
|
352
375
|
</classes>
|