ffc-pay-schemes 1.1.3 → 1.1.4

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.
Files changed (83) hide show
  1. package/README.md +1 -1
  2. package/app/scheme-id/get-scheme-id-from-pillar.js +3 -1
  3. package/package.json +1 -1
  4. package/test/unit/scheme-id/get-scheme-id-from-pillar.test.js +28 -0
  5. package/test-output/cobertura-coverage.xml +31 -17
  6. package/test-output/junit.xml +339 -333
  7. package/test-output/lcov-report/constants/account-codes/ap.js.html +1 -1
  8. package/test-output/lcov-report/constants/account-codes/ar-admin.js.html +1 -1
  9. package/test-output/lcov-report/constants/account-codes/ar-irregular.js.html +1 -1
  10. package/test-output/lcov-report/constants/account-codes/index.html +1 -1
  11. package/test-output/lcov-report/constants/delivery-bodies.js.html +1 -1
  12. package/test-output/lcov-report/constants/description-codes.js.html +1 -1
  13. package/test-output/lcov-report/constants/file-masks.js.html +1 -1
  14. package/test-output/lcov-report/constants/frps-schemes.js.html +1 -1
  15. package/test-output/lcov-report/constants/fund-codes.js.html +1 -1
  16. package/test-output/lcov-report/constants/index.html +1 -1
  17. package/test-output/lcov-report/constants/manual-sources.js.html +1 -1
  18. package/test-output/lcov-report/constants/pillars.js.html +1 -1
  19. package/test-output/lcov-report/constants/scheme-batch-properties.js.html +1 -1
  20. package/test-output/lcov-report/constants/scheme-ids.js.html +1 -1
  21. package/test-output/lcov-report/constants/scheme-names.js.html +1 -1
  22. package/test-output/lcov-report/constants/schemes-not-requiring-ppas.js.html +1 -1
  23. package/test-output/lcov-report/constants/schemes-providing-account-values.js.html +1 -1
  24. package/test-output/lcov-report/constants/schemes.js.html +1 -1
  25. package/test-output/lcov-report/constants/sequence-positions.js.html +1 -1
  26. package/test-output/lcov-report/constants/siti-agri-schemes.js.html +1 -1
  27. package/test-output/lcov-report/constants/source-systems.js.html +1 -1
  28. package/test-output/lcov-report/constants/unknown.js.html +1 -1
  29. package/test-output/lcov-report/create-invoice-number/create-default-invoice-number.js.html +1 -1
  30. package/test-output/lcov-report/create-invoice-number/create-es-invoice-number.js.html +1 -1
  31. package/test-output/lcov-report/create-invoice-number/create-imps-invoice-number.js.html +1 -1
  32. package/test-output/lcov-report/create-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
  33. package/test-output/lcov-report/create-invoice-number/create-standard-scheme-invoice-number.js.html +1 -1
  34. package/test-output/lcov-report/create-invoice-number/index.html +1 -1
  35. package/test-output/lcov-report/create-invoice-number/index.js.html +1 -1
  36. package/test-output/lcov-report/create-invoice-number/use-invoice-number-as-is.js.html +1 -1
  37. package/test-output/lcov-report/create-split-invoice-number/create-default-invoice-number.js.html +1 -1
  38. package/test-output/lcov-report/create-split-invoice-number/create-siti-agri-invoice-number.js.html +1 -1
  39. package/test-output/lcov-report/create-split-invoice-number/index.html +1 -1
  40. package/test-output/lcov-report/create-split-invoice-number/index.js.html +1 -1
  41. package/test-output/lcov-report/get-account-code-map/bps-map.js.html +1 -1
  42. package/test-output/lcov-report/get-account-code-map/cohtc-map.js.html +1 -1
  43. package/test-output/lcov-report/get-account-code-map/cs-map.js.html +1 -1
  44. package/test-output/lcov-report/get-account-code-map/default-map.js.html +1 -1
  45. package/test-output/lcov-report/get-account-code-map/delinked-map.js.html +1 -1
  46. package/test-output/lcov-report/get-account-code-map/index.html +1 -1
  47. package/test-output/lcov-report/get-account-code-map/index.js.html +1 -1
  48. package/test-output/lcov-report/get-account-code-map/lump-sums-map.js.html +1 -1
  49. package/test-output/lcov-report/get-account-code-map/sfi-frps-map.js.html +1 -1
  50. package/test-output/lcov-report/get-account-code-map/vet-visits-map.js.html +1 -1
  51. package/test-output/lcov-report/helpers/get-batch-sequence-from-file-name.js.html +1 -1
  52. package/test-output/lcov-report/helpers/get-delivery-body-from-scheme-id.js.html +115 -0
  53. package/test-output/lcov-report/helpers/get-fund-code-from-scheme-id.js.html +115 -0
  54. package/test-output/lcov-report/helpers/get-journal-source-from-pillar.js.html +1 -1
  55. package/test-output/lcov-report/helpers/get-reporting-data-filter.js.html +1 -1
  56. package/test-output/lcov-report/helpers/index.html +1 -1
  57. package/test-output/lcov-report/helpers/is-frps.js.html +1 -1
  58. package/test-output/lcov-report/helpers/is-siti-agri.js.html +1 -1
  59. package/test-output/lcov-report/helpers/scheme-does-not-require-ppas.js.html +1 -1
  60. package/test-output/lcov-report/helpers/scheme-provides-accounting-values.js.html +1 -1
  61. package/test-output/lcov-report/index.html +20 -20
  62. package/test-output/lcov-report/pillar/get-pillar-from-scheme-id.js.html +1 -1
  63. package/test-output/lcov-report/pillar/get-pillars.js.html +1 -1
  64. package/test-output/lcov-report/pillar/index.html +1 -1
  65. package/test-output/lcov-report/scheme-id/get-scheme-id-from-pillar.js.html +13 -7
  66. package/test-output/lcov-report/scheme-id/get-scheme-id-from-source-system.js.html +1 -1
  67. package/test-output/lcov-report/scheme-id/get-scheme-ids.js.html +1 -1
  68. package/test-output/lcov-report/scheme-id/get-siti-agri-scheme-ids.js.html +1 -1
  69. package/test-output/lcov-report/scheme-id/index.html +5 -5
  70. package/test-output/lcov-report/scheme-id/is-valid-scheme-id.js.html +1 -1
  71. package/test-output/lcov-report/scheme-name/get-scheme-name-from-scheme-id.js.html +1 -1
  72. package/test-output/lcov-report/scheme-name/get-scheme-names.js.html +1 -1
  73. package/test-output/lcov-report/scheme-name/index.html +1 -1
  74. package/test-output/lcov-report/scheme-properties/get-scheme-batch-properties.js.html +1 -1
  75. package/test-output/lcov-report/scheme-properties/get-scheme-from-batch-file-name.js.html +1 -1
  76. package/test-output/lcov-report/scheme-properties/get-scheme-properties.js.html +1 -1
  77. package/test-output/lcov-report/scheme-properties/get-schemes.js.html +1 -1
  78. package/test-output/lcov-report/scheme-properties/get-siti-agri-schemes.js.html +19 -19
  79. package/test-output/lcov-report/scheme-properties/index.html +18 -18
  80. package/test-output/lcov-report/source-system/get-source-system-from-scheme-id.js.html +1 -1
  81. package/test-output/lcov-report/source-system/get-source-systems.js.html +1 -1
  82. package/test-output/lcov-report/source-system/index.html +1 -1
  83. package/test-output/lcov.info +39 -22
package/README.md CHANGED
@@ -53,7 +53,7 @@ const {
53
53
  - `getReportingDataFilter(schemeId)` returns the fields which should be added to any data filters applied in reporting checks, for a given `schemeId`.
54
54
  - `getSchemeBatchProperties(schemeId)` returns the batch processing properties for a given `schemeId`.
55
55
  - `getSchemeFromBatchFileName(fileName)` returns the supported scheme details based on the expected file mask matching the supplied `fileName`.
56
- - `getSchemeIdFromPillar(pillar)` returns the scheme ID for a given `pillar`.
56
+ - `getSchemeIdFromPillar(pillar)` returns the scheme ID for a given `pillar`. Note the pillar match is case insensitive, i.e. `sfi26` and `Sfi26` will both match with `SFI26`.
57
57
  - `getSchemeIdFromSourceSystem(sourceSystem)` returns the scheme ID for a given `sourceSystem`.
58
58
  - `getSchemeIds()` returns all supported scheme IDs.
59
59
  - `getSchemeNameFromSchemeId(schemeId)` returns the scheme name for a given `schemeId`.
@@ -1,7 +1,9 @@
1
1
  const { getSchemes } = require('../scheme-properties/get-schemes')
2
2
 
3
3
  const getSchemeIdFromPillar = (pillar) => {
4
- const matchingScheme = getSchemes().find((scheme) => scheme.pillar === pillar)
4
+ const matchingScheme = getSchemes().find((scheme) =>
5
+ String(scheme.pillar ?? '').toLowerCase() === String(pillar ?? '').toLowerCase()
6
+ )
5
7
  return matchingScheme?.schemeId
6
8
  }
7
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ffc-pay-schemes",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Module for defining and providing details for the payment schemes supported by the Payment Hub.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,6 +23,34 @@ describe('getSchemeIdFromPillar', () => {
23
23
  expect(getSchemeIdFromPillar('Example Pillar')).toBe(1)
24
24
  })
25
25
 
26
+ test('matches the pillar regardless of case', () => {
27
+ getSchemes.mockReturnValue([
28
+ {
29
+ schemeId: 2,
30
+ schemeName: 'Example Scheme',
31
+ sourceSystem: 'Example Source',
32
+ pillar: 'Example Pillar'
33
+ }
34
+ ])
35
+
36
+ expect(getSchemeIdFromPillar('example pillar')).toBe(2)
37
+ expect(getSchemeIdFromPillar('EXAMPLE PILLAR')).toBe(2)
38
+ })
39
+
40
+ test('treats nullish pillar values as empty strings when comparing', () => {
41
+ getSchemes.mockReturnValue([
42
+ {
43
+ schemeId: 3,
44
+ schemeName: 'Example Scheme',
45
+ sourceSystem: 'Example Source',
46
+ pillar: undefined
47
+ }
48
+ ])
49
+
50
+ expect(getSchemeIdFromPillar(undefined)).toBe(3)
51
+ expect(getSchemeIdFromPillar('')).toBe(3)
52
+ })
53
+
26
54
  test('returns undefined when the pillar is not found', () => {
27
55
  getSchemes.mockReturnValue([
28
56
  {
@@ -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="312" lines-covered="312" line-rate="1" branches-valid="67" branches-covered="67" branch-rate="1" timestamp="1791821370454" complexity="0" version="0.1">
3
+ <coverage lines-valid="321" lines-covered="320" line-rate="0.9968" branches-valid="73" branches-covered="72" branch-rate="0.9863" timestamp="1793200016011" complexity="0" version="0.1">
4
4
  <sources>
5
5
  <source>/home/samplackett/ffc-pay-schemes</source>
6
6
  </sources>
@@ -667,23 +667,24 @@
667
667
  <classes>
668
668
  <class name="get-scheme-id-from-pillar.js" filename="app/scheme-id/get-scheme-id-from-pillar.js" line-rate="1" branch-rate="1">
669
669
  <methods>
670
- <method name="(anonymous_0)" hits="4" signature="()V">
670
+ <method name="(anonymous_0)" hits="8" signature="()V">
671
671
  <lines>
672
- <line number="3" hits="4"/>
672
+ <line number="3" hits="8"/>
673
673
  </lines>
674
674
  </method>
675
- <method name="(anonymous_1)" hits="2" signature="()V">
675
+ <method name="(anonymous_1)" hits="6" signature="()V">
676
676
  <lines>
677
- <line number="4" hits="2"/>
677
+ <line number="4" hits="6"/>
678
678
  </lines>
679
679
  </method>
680
680
  </methods>
681
681
  <lines>
682
682
  <line number="1" hits="1" branch="false"/>
683
683
  <line number="3" hits="1" branch="false"/>
684
- <line number="4" hits="4" branch="false"/>
685
- <line number="5" hits="4" branch="false"/>
686
- <line number="8" hits="1" branch="false"/>
684
+ <line number="4" hits="8" branch="false"/>
685
+ <line number="5" hits="6" branch="true" condition-coverage="100% (4/4)"/>
686
+ <line number="7" hits="8" branch="false"/>
687
+ <line number="10" hits="1" branch="false"/>
687
688
  </lines>
688
689
  </class>
689
690
  <class name="get-scheme-id-from-source-system.js" filename="app/scheme-id/get-scheme-id-from-source-system.js" line-rate="1" branch-rate="1">
@@ -796,7 +797,7 @@
796
797
  </class>
797
798
  </classes>
798
799
  </package>
799
- <package name="scheme-properties" line-rate="1" branch-rate="1">
800
+ <package name="scheme-properties" line-rate="0.9777" branch-rate="0.9166">
800
801
  <classes>
801
802
  <class name="get-scheme-batch-properties.js" filename="app/scheme-properties/get-scheme-batch-properties.js" line-rate="1" branch-rate="1">
802
803
  <methods>
@@ -902,16 +903,21 @@
902
903
  <line number="14" hits="1" branch="false"/>
903
904
  </lines>
904
905
  </class>
905
- <class name="get-siti-agri-schemes.js" filename="app/scheme-properties/get-siti-agri-schemes.js" line-rate="1" branch-rate="1">
906
+ <class name="get-siti-agri-schemes.js" filename="app/scheme-properties/get-siti-agri-schemes.js" line-rate="0.9333" branch-rate="0.5">
906
907
  <methods>
907
- <method name="(anonymous_0)" hits="1" signature="()V">
908
+ <method name="(anonymous_0)" hits="18" signature="()V">
908
909
  <lines>
909
- <line number="6" hits="1"/>
910
+ <line number="7" hits="18"/>
910
911
  </lines>
911
912
  </method>
912
- <method name="(anonymous_1)" hits="11" signature="()V">
913
+ <method name="(anonymous_1)" hits="2" signature="()V">
913
914
  <lines>
914
- <line number="7" hits="11"/>
915
+ <line number="12" hits="2"/>
916
+ </lines>
917
+ </method>
918
+ <method name="(anonymous_2)" hits="22" signature="()V">
919
+ <lines>
920
+ <line number="13" hits="22"/>
915
921
  </lines>
916
922
  </method>
917
923
  </methods>
@@ -920,9 +926,17 @@
920
926
  <line number="2" hits="1" branch="false"/>
921
927
  <line number="3" hits="1" branch="false"/>
922
928
  <line number="4" hits="1" branch="false"/>
923
- <line number="6" hits="1" branch="false"/>
924
- <line number="7" hits="11" branch="false"/>
925
- <line number="14" hits="1" branch="false"/>
929
+ <line number="5" hits="1" branch="false"/>
930
+ <line number="7" hits="1" branch="false"/>
931
+ <line number="8" hits="18" branch="false"/>
932
+ <line number="9" hits="18" branch="false"/>
933
+ <line number="12" hits="1" branch="false"/>
934
+ <line number="13" hits="2" branch="false"/>
935
+ <line number="14" hits="22" branch="false"/>
936
+ <line number="16" hits="22" branch="true" condition-coverage="50% (1/2)"/>
937
+ <line number="17" hits="0" branch="false"/>
938
+ <line number="20" hits="22" branch="false"/>
939
+ <line number="28" hits="1" branch="false"/>
926
940
  </lines>
927
941
  </class>
928
942
  </classes>