ffc-pay-schemes 1.0.14 → 1.0.15
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 +4 -0
- package/app/pillar/get-pillar-from-scheme-id.js +11 -0
- package/app/pillar/get-pillars.js +9 -0
- package/index.js +4 -0
- package/package.json +1 -1
- package/test/unit/pillar/get-pillar-from-scheme-id.test.js +51 -0
- package/test/unit/pillar/get-pillars.test.js +8 -0
- package/test-output/cobertura-coverage.xml +46 -3
- package/test-output/junit.xml +374 -360
- 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/file-masks.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/frps-schemes.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/manual-sources.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +2 -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 +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/sequence-positions.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/siti-agri-schemes.js.html +1 -1
- 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/helpers/get-batch-sequence-from-file-name.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-journal-source-from-pillar.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/get-reporting-data-filter.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-frps.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-siti-agri.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/is-valid-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-does-not-require-ppas.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/helpers/scheme-provides-accounting-values.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/pillar/get-pillar-from-scheme-id.js.html +118 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/pillar/get-pillars.js.html +112 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/pillar/index.html +131 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-pillar.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-id-from-source-system.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/get-scheme-ids.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-id/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-name-from-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/get-scheme-names.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-name/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-batch-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-from-batch-file-name.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-scheme-properties.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/get-schemes.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/scheme-properties/index.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-system-from-scheme-id.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/get-source-systems.js.html +1 -1
- package/test-output/lcov-report/ffc-pay-schemes/app/source-system/index.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 +16 -4
- package/test-output/lcov-report/index.html +24 -9
- package/test-output/lcov.info +41 -3
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@ const {
|
|
|
19
19
|
getAccountCodeMap,
|
|
20
20
|
getBatchSequenceFromFileName,
|
|
21
21
|
getJournalSourceFromPillar,
|
|
22
|
+
getPillarFromSchemeId,
|
|
23
|
+
getPillars,
|
|
22
24
|
getReportingDataFilter,
|
|
23
25
|
getSchemeBatchProperties,
|
|
24
26
|
getSchemeFromBatchFileName,
|
|
@@ -44,6 +46,8 @@ const {
|
|
|
44
46
|
- `getAccountCodeMap(schemeId)` returns the account code mapping used for a given `schemeId`.
|
|
45
47
|
- `getBatchSequenceFromFileName(schemeId, fileName)` returns the sequence as identified in the supplied `fileName`, checking the correct position using the `schemeId`.
|
|
46
48
|
- `getJournalSourceFromPillar(schemeId, source, pillar)` returns the appropriate manual source used in Payment journals for manual schemes, based on the supplied `pillar`. If `schemeId` is not the MANUAL scheme, or a match is not found, the supplied `source` will be returned.
|
|
49
|
+
- `getPillarFromSchemeId(schemeId)` returns the pillar name for a given `schemeId`.
|
|
50
|
+
- `getPillars()` returns all supported pillars.
|
|
47
51
|
- `getReportingDataFilter(schemeId)` returns the fields which should be added to any data filters applied in reporting checks, for a given `schemeId`.
|
|
48
52
|
- `getSchemeBatchProperties(schemeId)` returns the batch processing properties for a given `schemeId`.
|
|
49
53
|
- `getSchemeFromBatchFileName(fileName)` returns the supported scheme details based on the expected file mask matching the supplied `fileName`.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { UNKNOWN } = require('../constants/unknown')
|
|
2
|
+
const { getSchemes } = require('../scheme-properties/get-schemes')
|
|
3
|
+
|
|
4
|
+
const getPillarFromSchemeId = (schemeId) => {
|
|
5
|
+
const matchingScheme = getSchemes().find((scheme) => scheme.schemeId === schemeId)
|
|
6
|
+
return matchingScheme?.pillar ?? UNKNOWN
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
getPillarFromSchemeId
|
|
11
|
+
}
|
package/index.js
CHANGED
|
@@ -3,6 +3,8 @@ const { createSplitInvoiceNumber } = require('./app/create-split-invoice-number'
|
|
|
3
3
|
const { getAccountCodeMap } = require('./app/get-account-code-map')
|
|
4
4
|
const { getBatchSequenceFromFileName } = require('./app/helpers/get-batch-sequence-from-file-name')
|
|
5
5
|
const { getJournalSourceFromPillar } = require('./app/helpers/get-journal-source-from-pillar')
|
|
6
|
+
const { getPillarFromSchemeId } = require('./app/pillar/get-pillar-from-scheme-id')
|
|
7
|
+
const { getPillars } = require('./app/pillar/get-pillars')
|
|
6
8
|
const { getReportingDataFilter } = require('./app/helpers/get-reporting-data-filter')
|
|
7
9
|
const { getSchemeBatchProperties } = require('./app/scheme-properties/get-scheme-batch-properties')
|
|
8
10
|
const { getSchemeFromBatchFileName } = require('./app/scheme-properties/get-scheme-from-batch-file-name')
|
|
@@ -27,6 +29,8 @@ module.exports = {
|
|
|
27
29
|
getAccountCodeMap,
|
|
28
30
|
getBatchSequenceFromFileName,
|
|
29
31
|
getJournalSourceFromPillar,
|
|
32
|
+
getPillarFromSchemeId,
|
|
33
|
+
getPillars,
|
|
30
34
|
getReportingDataFilter,
|
|
31
35
|
getSchemeBatchProperties,
|
|
32
36
|
getSchemeFromBatchFileName,
|
package/package.json
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
jest.mock('../../../app/scheme-properties/get-schemes', () => ({
|
|
2
|
+
getSchemes: jest.fn()
|
|
3
|
+
}))
|
|
4
|
+
|
|
5
|
+
const { UNKNOWN } = require('../../../app/constants/unknown')
|
|
6
|
+
const { getSchemes } = require('../../../app/scheme-properties/get-schemes')
|
|
7
|
+
const { getPillarFromSchemeId } = require('../../../app/pillar/get-pillar-from-scheme-id')
|
|
8
|
+
|
|
9
|
+
describe('getPillarFromSchemeId', () => {
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
jest.clearAllMocks()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('returns the pillar for a matching scheme ID', () => {
|
|
15
|
+
getSchemes.mockReturnValue([
|
|
16
|
+
{
|
|
17
|
+
schemeId: 1,
|
|
18
|
+
schemeName: 'Example Scheme',
|
|
19
|
+
pillar: 'Example Pillar'
|
|
20
|
+
}
|
|
21
|
+
])
|
|
22
|
+
|
|
23
|
+
expect(getPillarFromSchemeId(1)).toBe('Example Pillar')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
test('returns unknown when the scheme ID is not found', () => {
|
|
27
|
+
getSchemes.mockReturnValue([
|
|
28
|
+
{
|
|
29
|
+
schemeId: 1,
|
|
30
|
+
schemeName: 'Example Scheme',
|
|
31
|
+
pillar: 'Example Pillar'
|
|
32
|
+
}
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
expect(getPillarFromSchemeId(2)).toBe(UNKNOWN)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('returns unknown when no schemes are available', () => {
|
|
39
|
+
getSchemes.mockReturnValue([])
|
|
40
|
+
|
|
41
|
+
expect(getPillarFromSchemeId(2)).toBe(UNKNOWN)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('gets schemes before searching for the pillar', () => {
|
|
45
|
+
getSchemes.mockReturnValue([])
|
|
46
|
+
|
|
47
|
+
getPillarFromSchemeId(2)
|
|
48
|
+
|
|
49
|
+
expect(getSchemes).toHaveBeenCalledTimes(1)
|
|
50
|
+
})
|
|
51
|
+
})
|
|
@@ -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="326" lines-covered="300" line-rate="0.9201999999999999" branches-valid="67" branches-covered="67" branch-rate="1" timestamp="1789392577997" complexity="0" version="0.1">
|
|
4
4
|
<sources>
|
|
5
5
|
<source>/home/samplackett/ffc-pay-schemes</source>
|
|
6
6
|
</sources>
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
<line number="20" hits="0" branch="false"/>
|
|
34
34
|
<line number="21" hits="0" branch="false"/>
|
|
35
35
|
<line number="22" hits="0" branch="false"/>
|
|
36
|
+
<line number="23" hits="0" branch="false"/>
|
|
36
37
|
<line number="24" hits="0" branch="false"/>
|
|
38
|
+
<line number="26" hits="0" branch="false"/>
|
|
37
39
|
</lines>
|
|
38
40
|
</class>
|
|
39
41
|
</classes>
|
|
@@ -88,7 +90,7 @@
|
|
|
88
90
|
<methods>
|
|
89
91
|
</methods>
|
|
90
92
|
<lines>
|
|
91
|
-
<line number="1" hits="
|
|
93
|
+
<line number="1" hits="4" branch="false"/>
|
|
92
94
|
</lines>
|
|
93
95
|
</class>
|
|
94
96
|
<class name="scheme-batch-properties.js" filename="app/constants/scheme-batch-properties.js" line-rate="1" branch-rate="1">
|
|
@@ -168,7 +170,7 @@
|
|
|
168
170
|
<methods>
|
|
169
171
|
</methods>
|
|
170
172
|
<lines>
|
|
171
|
-
<line number="1" hits="
|
|
173
|
+
<line number="1" hits="3" branch="false"/>
|
|
172
174
|
</lines>
|
|
173
175
|
</class>
|
|
174
176
|
</classes>
|
|
@@ -671,6 +673,47 @@
|
|
|
671
673
|
</class>
|
|
672
674
|
</classes>
|
|
673
675
|
</package>
|
|
676
|
+
<package name="ffc-pay-schemes.app.pillar" line-rate="1" branch-rate="1">
|
|
677
|
+
<classes>
|
|
678
|
+
<class name="get-pillar-from-scheme-id.js" filename="app/pillar/get-pillar-from-scheme-id.js" line-rate="1" branch-rate="1">
|
|
679
|
+
<methods>
|
|
680
|
+
<method name="(anonymous_0)" hits="4" signature="()V">
|
|
681
|
+
<lines>
|
|
682
|
+
<line number="4" hits="4"/>
|
|
683
|
+
</lines>
|
|
684
|
+
</method>
|
|
685
|
+
<method name="(anonymous_1)" hits="2" signature="()V">
|
|
686
|
+
<lines>
|
|
687
|
+
<line number="5" hits="2"/>
|
|
688
|
+
</lines>
|
|
689
|
+
</method>
|
|
690
|
+
</methods>
|
|
691
|
+
<lines>
|
|
692
|
+
<line number="1" hits="1" branch="false"/>
|
|
693
|
+
<line number="2" hits="1" branch="false"/>
|
|
694
|
+
<line number="4" hits="1" branch="false"/>
|
|
695
|
+
<line number="5" hits="4" branch="false"/>
|
|
696
|
+
<line number="6" hits="4" branch="true" condition-coverage="100% (2/2)"/>
|
|
697
|
+
<line number="9" hits="1" branch="false"/>
|
|
698
|
+
</lines>
|
|
699
|
+
</class>
|
|
700
|
+
<class name="get-pillars.js" filename="app/pillar/get-pillars.js" line-rate="1" branch-rate="1">
|
|
701
|
+
<methods>
|
|
702
|
+
<method name="(anonymous_0)" hits="1" signature="()V">
|
|
703
|
+
<lines>
|
|
704
|
+
<line number="3" hits="1"/>
|
|
705
|
+
</lines>
|
|
706
|
+
</method>
|
|
707
|
+
</methods>
|
|
708
|
+
<lines>
|
|
709
|
+
<line number="1" hits="1" branch="false"/>
|
|
710
|
+
<line number="3" hits="1" branch="false"/>
|
|
711
|
+
<line number="4" hits="1" branch="false"/>
|
|
712
|
+
<line number="7" hits="1" branch="false"/>
|
|
713
|
+
</lines>
|
|
714
|
+
</class>
|
|
715
|
+
</classes>
|
|
716
|
+
</package>
|
|
674
717
|
<package name="ffc-pay-schemes.app.scheme-id" line-rate="1" branch-rate="1">
|
|
675
718
|
<classes>
|
|
676
719
|
<class name="get-scheme-id-from-pillar.js" filename="app/scheme-id/get-scheme-id-from-pillar.js" line-rate="1" branch-rate="1">
|