ffc-pay-schemes 1.0.13 → 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 +13 -7
- package/app/constants/manual-sources.js +79 -0
- package/app/constants/pillars.js +21 -0
- package/app/helpers/get-journal-source-from-pillar.js +15 -0
- package/app/pillar/get-pillar-from-scheme-id.js +11 -0
- package/app/pillar/get-pillars.js +9 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/test/unit/helpers/get-journal-source-from-pillar.test.js +25 -0
- 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 +76 -5
- package/test-output/junit.xml +325 -301
- 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 +20 -5
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/manual-sources.js.html +322 -0
- package/test-output/lcov-report/ffc-pay-schemes/app/constants/pillars.js.html +65 -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 +2 -2
- 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 +130 -0
- 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 +20 -5
- 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 +22 -4
- package/test-output/lcov-report/index.html +33 -18
- package/test-output/lcov.info +77 -4
package/README.md
CHANGED
|
@@ -18,6 +18,9 @@ const {
|
|
|
18
18
|
createSplitInvoiceNumber,
|
|
19
19
|
getAccountCodeMap,
|
|
20
20
|
getBatchSequenceFromFileName,
|
|
21
|
+
getJournalSourceFromPillar,
|
|
22
|
+
getPillarFromSchemeId,
|
|
23
|
+
getPillars,
|
|
21
24
|
getReportingDataFilter,
|
|
22
25
|
getSchemeBatchProperties,
|
|
23
26
|
getSchemeFromBatchFileName,
|
|
@@ -42,6 +45,9 @@ const {
|
|
|
42
45
|
- `createSplitInvoiceNumber(paymentRequest)` creates a split invoice number for a given `paymentRequest`.
|
|
43
46
|
- `getAccountCodeMap(schemeId)` returns the account code mapping used for a given `schemeId`.
|
|
44
47
|
- `getBatchSequenceFromFileName(schemeId, fileName)` returns the sequence as identified in the supplied `fileName`, checking the correct position using the `schemeId`.
|
|
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.
|
|
45
51
|
- `getReportingDataFilter(schemeId)` returns the fields which should be added to any data filters applied in reporting checks, for a given `schemeId`.
|
|
46
52
|
- `getSchemeBatchProperties(schemeId)` returns the batch processing properties for a given `schemeId`.
|
|
47
53
|
- `getSchemeFromBatchFileName(fileName)` returns the supported scheme details based on the expected file mask matching the supplied `fileName`.
|
|
@@ -65,18 +71,20 @@ const {
|
|
|
65
71
|
```js
|
|
66
72
|
const {
|
|
67
73
|
getSchemes,
|
|
74
|
+
getSchemeIds,
|
|
68
75
|
getSchemeProperties,
|
|
69
76
|
schemeDoesNotRequirePPAs,
|
|
70
|
-
schemeProvidesAccountingValues
|
|
71
|
-
schemeIds
|
|
77
|
+
schemeProvidesAccountingValues
|
|
72
78
|
} = require('ffc-pay-schemes')
|
|
73
79
|
|
|
74
80
|
const schemes = getSchemes()
|
|
75
81
|
|
|
76
|
-
const
|
|
82
|
+
const { BPS } = getSchemeIds()
|
|
83
|
+
|
|
84
|
+
const scheme = getSchemeProperties(BPS)
|
|
77
85
|
|
|
78
|
-
const doesNotRequirePPAs = schemeDoesNotRequirePPAs(
|
|
79
|
-
const providesAccountingValues = schemeProvidesAccountingValues(
|
|
86
|
+
const doesNotRequirePPAs = schemeDoesNotRequirePPAs(BPS)
|
|
87
|
+
const providesAccountingValues = schemeProvidesAccountingValues(BPS)
|
|
80
88
|
```
|
|
81
89
|
|
|
82
90
|
## Payment Hub usage
|
|
@@ -85,7 +93,6 @@ The following services are intended to be used with the ffc-pay-schemes package:
|
|
|
85
93
|
|
|
86
94
|
- ffc-pay-alerting
|
|
87
95
|
- ffc-pay-batch-processor
|
|
88
|
-
- ffc-pay-dps
|
|
89
96
|
- ffc-pay-enrichment
|
|
90
97
|
- ffc-pay-event-hub
|
|
91
98
|
- ffc-pay-gateway
|
|
@@ -95,7 +102,6 @@ The following services are intended to be used with the ffc-pay-schemes package:
|
|
|
95
102
|
- ffc-pay-submission
|
|
96
103
|
- ffc-pay-tracking
|
|
97
104
|
- ffc-pay-web
|
|
98
|
-
- ffc-pay-xb
|
|
99
105
|
|
|
100
106
|
In the event a new payment scheme is added to the package, all of the above services must be bumped to the latest package version to ensure that Payment Hub can process associated payments.
|
|
101
107
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
const {
|
|
2
|
+
DA,
|
|
3
|
+
IP,
|
|
4
|
+
SPS,
|
|
5
|
+
DF,
|
|
6
|
+
FCCS,
|
|
7
|
+
XG,
|
|
8
|
+
TR,
|
|
9
|
+
RDPECS,
|
|
10
|
+
RDPELS,
|
|
11
|
+
BK,
|
|
12
|
+
INT,
|
|
13
|
+
OPA,
|
|
14
|
+
NELS,
|
|
15
|
+
FCLS,
|
|
16
|
+
RDTLS,
|
|
17
|
+
NECS,
|
|
18
|
+
RDTCP,
|
|
19
|
+
P1,
|
|
20
|
+
EA,
|
|
21
|
+
RDTEXQ,
|
|
22
|
+
EXNRDPE,
|
|
23
|
+
SFI,
|
|
24
|
+
SFI_PILOT,
|
|
25
|
+
LUMP_SUMS,
|
|
26
|
+
VET_VISITS,
|
|
27
|
+
CS,
|
|
28
|
+
BPS,
|
|
29
|
+
ES,
|
|
30
|
+
FC,
|
|
31
|
+
IMPS,
|
|
32
|
+
SFI23,
|
|
33
|
+
DELINKED,
|
|
34
|
+
SFI_EXPANDED,
|
|
35
|
+
COHT_CAPITAL,
|
|
36
|
+
COHT_REVENUE,
|
|
37
|
+
FPTT,
|
|
38
|
+
WMP
|
|
39
|
+
} = require('./pillars')
|
|
40
|
+
|
|
41
|
+
module.exports = {
|
|
42
|
+
[DA]: 'NMAN_DA',
|
|
43
|
+
[IP]: 'NMAN_IP',
|
|
44
|
+
[SPS]: 'NMAN_SPS',
|
|
45
|
+
[DF]: 'NMAN_DF',
|
|
46
|
+
[FCCS]: 'NMAN_FC',
|
|
47
|
+
[XG]: 'NMAN_XG',
|
|
48
|
+
[TR]: 'NMAN_TR',
|
|
49
|
+
[RDPECS]: 'NMAN_RDPE',
|
|
50
|
+
[RDPELS]: 'NMAN_RDPE',
|
|
51
|
+
[BK]: 'NMAN_BK',
|
|
52
|
+
[INT]: 'NMAN_INT',
|
|
53
|
+
[OPA]: 'NMAN_OPA',
|
|
54
|
+
[NELS]: 'NMAN_NELS',
|
|
55
|
+
[FCLS]: 'NMAN_FCLS',
|
|
56
|
+
[RDTLS]: 'NMAN_RDT',
|
|
57
|
+
[NECS]: 'NMAN_NE',
|
|
58
|
+
[RDTCP]: 'NMAN_RDT',
|
|
59
|
+
[P1]: 'NMAN_NE',
|
|
60
|
+
[EA]: 'NMAN_EA',
|
|
61
|
+
[RDTEXQ]: 'NMAN_RDT',
|
|
62
|
+
[EXNRDPE]: 'NMAN_RDT',
|
|
63
|
+
[SFI]: 'PMAN_SFI',
|
|
64
|
+
[SFI_PILOT]: 'PMAN_SFIP',
|
|
65
|
+
[LUMP_SUMS]: 'NMAN_DA',
|
|
66
|
+
[VET_VISITS]: 'NMAN_DA',
|
|
67
|
+
[CS]: 'PMAN_CS',
|
|
68
|
+
[BPS]: 'NMAN_DA',
|
|
69
|
+
[ES]: 'NMAN_DA',
|
|
70
|
+
[FC]: 'NMAN_DA',
|
|
71
|
+
[IMPS]: 'NMAN_DA',
|
|
72
|
+
[SFI23]: 'PMAN_SFIA',
|
|
73
|
+
[DELINKED]: 'PMAN_DP',
|
|
74
|
+
[SFI_EXPANDED]: 'PMAN_ESFIO',
|
|
75
|
+
[COHT_CAPITAL]: 'PMAN_COHTC',
|
|
76
|
+
[COHT_REVENUE]: 'PMAN_COHTR',
|
|
77
|
+
[FPTT]: 'PMAN_FPTT',
|
|
78
|
+
[WMP]: 'PMAN_WMP'
|
|
79
|
+
}
|
package/app/constants/pillars.js
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
+
DA: 'DA',
|
|
3
|
+
IP: 'IP',
|
|
4
|
+
SPS: 'SPS',
|
|
5
|
+
DF: 'DF',
|
|
6
|
+
FCCS: 'FCCS',
|
|
7
|
+
XG: 'XG',
|
|
8
|
+
TR: 'TR',
|
|
9
|
+
RDPECS: 'RDPECS',
|
|
10
|
+
RDPELS: 'RDPELS',
|
|
11
|
+
BK: 'BK',
|
|
12
|
+
INT: 'INT',
|
|
13
|
+
OPA: 'OPA',
|
|
14
|
+
NELS: 'NELS',
|
|
15
|
+
FCLS: 'FCLS',
|
|
16
|
+
RDTLS: 'RDTLS',
|
|
17
|
+
NECS: 'NECS',
|
|
18
|
+
RDTCP: 'RDTCP',
|
|
19
|
+
P1: 'P1',
|
|
20
|
+
EA: 'EA',
|
|
21
|
+
RDTEXQ: 'RDTEXQ',
|
|
22
|
+
EXNRDPE: 'ExNRDPE',
|
|
2
23
|
SFI: 'SFI',
|
|
3
24
|
SFI_PILOT: 'SFIP',
|
|
4
25
|
LUMP_SUMS: 'LSES',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { MANUAL } = require('../constants/scheme-ids')
|
|
2
|
+
const manualSources = require('../constants/manual-sources')
|
|
3
|
+
|
|
4
|
+
const getJournalSourceFromPillar = (schemeId, source, pillar) => {
|
|
5
|
+
if (schemeId !== MANUAL) {
|
|
6
|
+
return source
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const manualSource = manualSources[pillar]
|
|
10
|
+
return manualSource ?? source
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
getJournalSourceFromPillar
|
|
15
|
+
}
|
|
@@ -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
|
@@ -2,6 +2,9 @@ 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 { getBatchSequenceFromFileName } = require('./app/helpers/get-batch-sequence-from-file-name')
|
|
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')
|
|
5
8
|
const { getReportingDataFilter } = require('./app/helpers/get-reporting-data-filter')
|
|
6
9
|
const { getSchemeBatchProperties } = require('./app/scheme-properties/get-scheme-batch-properties')
|
|
7
10
|
const { getSchemeFromBatchFileName } = require('./app/scheme-properties/get-scheme-from-batch-file-name')
|
|
@@ -25,6 +28,9 @@ module.exports = {
|
|
|
25
28
|
createSplitInvoiceNumber,
|
|
26
29
|
getAccountCodeMap,
|
|
27
30
|
getBatchSequenceFromFileName,
|
|
31
|
+
getJournalSourceFromPillar,
|
|
32
|
+
getPillarFromSchemeId,
|
|
33
|
+
getPillars,
|
|
28
34
|
getReportingDataFilter,
|
|
29
35
|
getSchemeBatchProperties,
|
|
30
36
|
getSchemeFromBatchFileName,
|
package/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { MANUAL, SFI } = require('../../../app/constants/scheme-ids')
|
|
2
|
+
const { DA, SFI: SFI_PILLAR } = require('../../../app/constants/pillars')
|
|
3
|
+
const manualSources = require('../../../app/constants/manual-sources')
|
|
4
|
+
const { getJournalSourceFromPillar } = require('../../../app/helpers/get-journal-source-from-pillar')
|
|
5
|
+
|
|
6
|
+
describe('getJournalSourceFromPillar', () => {
|
|
7
|
+
test('returns the source for non-manual schemes', () => {
|
|
8
|
+
expect(getJournalSourceFromPillar(SFI, 'SOURCE', DA)).toBe('SOURCE')
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
test('returns the manual source for a matching pillar', () => {
|
|
12
|
+
expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', DA))
|
|
13
|
+
.toBe(manualSources[DA])
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('returns the manual source for the SFI pillar', () => {
|
|
17
|
+
expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', SFI_PILLAR))
|
|
18
|
+
.toBe(manualSources[SFI_PILLAR])
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('returns the original source when the pillar has no manual source', () => {
|
|
22
|
+
expect(getJournalSourceFromPillar(MANUAL, 'SOURCE', 'UNKNOWN'))
|
|
23
|
+
.toBe('SOURCE')
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -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>
|
|
@@ -32,12 +32,15 @@
|
|
|
32
32
|
<line number="19" hits="0" branch="false"/>
|
|
33
33
|
<line number="20" hits="0" branch="false"/>
|
|
34
34
|
<line number="21" hits="0" branch="false"/>
|
|
35
|
+
<line number="22" hits="0" branch="false"/>
|
|
35
36
|
<line number="23" hits="0" branch="false"/>
|
|
37
|
+
<line number="24" hits="0" branch="false"/>
|
|
38
|
+
<line number="26" hits="0" branch="false"/>
|
|
36
39
|
</lines>
|
|
37
40
|
</class>
|
|
38
41
|
</classes>
|
|
39
42
|
</package>
|
|
40
|
-
<package name="ffc-pay-schemes.app.constants" line-rate="0.
|
|
43
|
+
<package name="ffc-pay-schemes.app.constants" line-rate="0.9655" branch-rate="1">
|
|
41
44
|
<classes>
|
|
42
45
|
<class name="delivery-bodies.js" filename="app/constants/delivery-bodies.js" line-rate="1" branch-rate="1">
|
|
43
46
|
<methods>
|
|
@@ -75,11 +78,19 @@
|
|
|
75
78
|
<line number="1" hits="1" branch="false"/>
|
|
76
79
|
</lines>
|
|
77
80
|
</class>
|
|
81
|
+
<class name="manual-sources.js" filename="app/constants/manual-sources.js" line-rate="1" branch-rate="1">
|
|
82
|
+
<methods>
|
|
83
|
+
</methods>
|
|
84
|
+
<lines>
|
|
85
|
+
<line number="39" hits="1" branch="false"/>
|
|
86
|
+
<line number="41" hits="1" branch="false"/>
|
|
87
|
+
</lines>
|
|
88
|
+
</class>
|
|
78
89
|
<class name="pillars.js" filename="app/constants/pillars.js" line-rate="1" branch-rate="1">
|
|
79
90
|
<methods>
|
|
80
91
|
</methods>
|
|
81
92
|
<lines>
|
|
82
|
-
<line number="1" hits="
|
|
93
|
+
<line number="1" hits="4" branch="false"/>
|
|
83
94
|
</lines>
|
|
84
95
|
</class>
|
|
85
96
|
<class name="scheme-batch-properties.js" filename="app/constants/scheme-batch-properties.js" line-rate="1" branch-rate="1">
|
|
@@ -94,7 +105,7 @@
|
|
|
94
105
|
<methods>
|
|
95
106
|
</methods>
|
|
96
107
|
<lines>
|
|
97
|
-
<line number="1" hits="
|
|
108
|
+
<line number="1" hits="13" branch="false"/>
|
|
98
109
|
</lines>
|
|
99
110
|
</class>
|
|
100
111
|
<class name="scheme-names.js" filename="app/constants/scheme-names.js" line-rate="1" branch-rate="1">
|
|
@@ -159,7 +170,7 @@
|
|
|
159
170
|
<methods>
|
|
160
171
|
</methods>
|
|
161
172
|
<lines>
|
|
162
|
-
<line number="1" hits="
|
|
173
|
+
<line number="1" hits="3" branch="false"/>
|
|
163
174
|
</lines>
|
|
164
175
|
</class>
|
|
165
176
|
</classes>
|
|
@@ -543,6 +554,25 @@
|
|
|
543
554
|
<line number="32" hits="1" branch="false"/>
|
|
544
555
|
</lines>
|
|
545
556
|
</class>
|
|
557
|
+
<class name="get-journal-source-from-pillar.js" filename="app/helpers/get-journal-source-from-pillar.js" line-rate="1" branch-rate="1">
|
|
558
|
+
<methods>
|
|
559
|
+
<method name="(anonymous_0)" hits="4" signature="()V">
|
|
560
|
+
<lines>
|
|
561
|
+
<line number="4" hits="4"/>
|
|
562
|
+
</lines>
|
|
563
|
+
</method>
|
|
564
|
+
</methods>
|
|
565
|
+
<lines>
|
|
566
|
+
<line number="1" hits="1" branch="false"/>
|
|
567
|
+
<line number="2" hits="1" branch="false"/>
|
|
568
|
+
<line number="4" hits="1" branch="false"/>
|
|
569
|
+
<line number="5" hits="4" branch="true" condition-coverage="100% (2/2)"/>
|
|
570
|
+
<line number="6" hits="1" branch="false"/>
|
|
571
|
+
<line number="9" hits="3" branch="false"/>
|
|
572
|
+
<line number="10" hits="3" branch="true" condition-coverage="100% (2/2)"/>
|
|
573
|
+
<line number="13" hits="1" branch="false"/>
|
|
574
|
+
</lines>
|
|
575
|
+
</class>
|
|
546
576
|
<class name="get-reporting-data-filter.js" filename="app/helpers/get-reporting-data-filter.js" line-rate="1" branch-rate="1">
|
|
547
577
|
<methods>
|
|
548
578
|
<method name="(anonymous_0)" hits="5" signature="()V">
|
|
@@ -643,6 +673,47 @@
|
|
|
643
673
|
</class>
|
|
644
674
|
</classes>
|
|
645
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>
|
|
646
717
|
<package name="ffc-pay-schemes.app.scheme-id" line-rate="1" branch-rate="1">
|
|
647
718
|
<classes>
|
|
648
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">
|