@natlibfi/marc-record-validators-melinda 9.0.6 → 9.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.
Files changed (139) hide show
  1. package/.github/CODEOWNERS +10 -0
  2. package/.github/dependabot.yml +40 -0
  3. package/.github/workflows/melinda-node-tests.yml +61 -0
  4. package/LICENSE.txt +21 -165
  5. package/README.md +1 -1
  6. package/dist/access-rights.js +0 -27
  7. package/dist/access-rights.js.map +1 -1
  8. package/dist/access-rights.spec.js +0 -27
  9. package/dist/access-rights.spec.js.map +1 -1
  10. package/dist/double-commas.js +0 -27
  11. package/dist/double-commas.js.map +1 -1
  12. package/dist/double-commas.spec.js +0 -27
  13. package/dist/double-commas.spec.js.map +1 -1
  14. package/dist/duplicates-ind1.js +0 -27
  15. package/dist/duplicates-ind1.js.map +1 -1
  16. package/dist/duplicates-ind1.spec.js +0 -27
  17. package/dist/duplicates-ind1.spec.js.map +1 -1
  18. package/dist/empty-fields.js +0 -28
  19. package/dist/empty-fields.js.map +1 -1
  20. package/dist/empty-fields.spec.js +0 -27
  21. package/dist/empty-fields.spec.js.map +1 -1
  22. package/dist/ending-punctuation-conf.js +0 -28
  23. package/dist/ending-punctuation-conf.js.map +1 -1
  24. package/dist/ending-punctuation.js.map +1 -1
  25. package/dist/ending-punctuation.spec.js +0 -27
  26. package/dist/ending-punctuation.spec.js.map +1 -1
  27. package/dist/field-exclusion.js +0 -28
  28. package/dist/field-exclusion.js.map +1 -1
  29. package/dist/field-exclusion.spec.js +0 -27
  30. package/dist/field-exclusion.spec.js.map +1 -1
  31. package/dist/field-structure.js +0 -28
  32. package/dist/field-structure.js.map +1 -1
  33. package/dist/field-structure.spec.js +0 -27
  34. package/dist/field-structure.spec.js.map +1 -1
  35. package/dist/fields-present.js +0 -27
  36. package/dist/fields-present.js.map +1 -1
  37. package/dist/fields-present.spec.js +0 -27
  38. package/dist/fields-present.spec.js.map +1 -1
  39. package/dist/fixed-fields.js +0 -27
  40. package/dist/fixed-fields.js.map +1 -1
  41. package/dist/fixed-fields.spec.js +0 -27
  42. package/dist/fixed-fields.spec.js.map +1 -1
  43. package/dist/identical-fields.js +0 -28
  44. package/dist/identical-fields.js.map +1 -1
  45. package/dist/identical-fields.spec.js +0 -27
  46. package/dist/identical-fields.spec.js.map +1 -1
  47. package/dist/index.js.map +1 -1
  48. package/dist/isbn-issn.js +0 -27
  49. package/dist/isbn-issn.js.map +1 -1
  50. package/dist/isbn-issn.spec.js +0 -27
  51. package/dist/isbn-issn.spec.js.map +1 -1
  52. package/dist/item-language.js +0 -27
  53. package/dist/item-language.js.map +1 -1
  54. package/dist/item-language.spec.js +0 -27
  55. package/dist/item-language.spec.js.map +1 -1
  56. package/dist/punctuation/index.js +21 -1
  57. package/dist/punctuation/index.js.map +1 -1
  58. package/dist/punctuation/rules/aut.js.map +1 -1
  59. package/dist/punctuation/rules/bib.js +8 -1
  60. package/dist/punctuation/rules/bib.js.map +1 -1
  61. package/dist/punctuation/rules/index.js.map +1 -1
  62. package/dist/punctuation.spec.js +49 -140
  63. package/dist/punctuation.spec.js.map +1 -1
  64. package/dist/resolvable-ext-references-melinda.js +0 -27
  65. package/dist/resolvable-ext-references-melinda.js.map +1 -1
  66. package/dist/resolvable-ext-references-melinda.spec.js +3 -29
  67. package/dist/resolvable-ext-references-melinda.spec.js.map +1 -1
  68. package/dist/sort-tags.js +0 -27
  69. package/dist/sort-tags.js.map +1 -1
  70. package/dist/sort-tags.spec.js +0 -27
  71. package/dist/sort-tags.spec.js.map +1 -1
  72. package/dist/subfield-exclusion.js +0 -28
  73. package/dist/subfield-exclusion.js.map +1 -1
  74. package/dist/subfield-exclusion.spec.js +0 -27
  75. package/dist/subfield-exclusion.spec.js.map +1 -1
  76. package/dist/unicode-decomposition.js +0 -28
  77. package/dist/unicode-decomposition.js.map +1 -1
  78. package/dist/unicode-decomposition.spec.js +0 -27
  79. package/dist/unicode-decomposition.spec.js.map +1 -1
  80. package/dist/urn.js +0 -27
  81. package/dist/urn.js.map +1 -1
  82. package/dist/urn.spec.js +0 -27
  83. package/dist/urn.spec.js.map +1 -1
  84. package/package.json +5 -3
  85. package/src/access-rights.js +0 -29
  86. package/src/access-rights.spec.js +0 -29
  87. package/src/double-commas.js +0 -29
  88. package/src/double-commas.spec.js +0 -29
  89. package/src/duplicates-ind1.js +0 -29
  90. package/src/duplicates-ind1.spec.js +0 -29
  91. package/src/empty-fields.js +0 -28
  92. package/src/empty-fields.spec.js +0 -29
  93. package/src/ending-punctuation-conf.js +0 -29
  94. package/src/ending-punctuation.spec.js +0 -29
  95. package/src/field-exclusion.js +0 -29
  96. package/src/field-exclusion.spec.js +0 -29
  97. package/src/field-structure.js +0 -29
  98. package/src/field-structure.spec.js +0 -29
  99. package/src/fields-present.js +0 -29
  100. package/src/fields-present.spec.js +0 -29
  101. package/src/fixed-fields.js +0 -29
  102. package/src/fixed-fields.spec.js +0 -29
  103. package/src/identical-fields.js +0 -28
  104. package/src/identical-fields.spec.js +0 -29
  105. package/src/index.js +0 -29
  106. package/src/isbn-issn.js +0 -28
  107. package/src/isbn-issn.spec.js +0 -29
  108. package/src/item-language.js +0 -29
  109. package/src/item-language.spec.js +0 -29
  110. package/src/punctuation/index.js +19 -1
  111. package/src/punctuation/rules/bib.js +9 -1
  112. package/src/punctuation.spec.js +48 -147
  113. package/src/resolvable-ext-references-melinda.js +0 -28
  114. package/src/resolvable-ext-references-melinda.spec.js +2 -30
  115. package/src/sort-tags.js +0 -29
  116. package/src/sort-tags.spec.js +0 -29
  117. package/src/subfield-exclusion.js +0 -29
  118. package/src/subfield-exclusion.spec.js +0 -29
  119. package/src/unicode-decomposition.js +0 -28
  120. package/src/unicode-decomposition.spec.js +0 -29
  121. package/src/urn.js +0 -29
  122. package/src/urn.spec.js +0 -29
  123. package/test-fixtures/punctuation/01/expectedResult.json +3 -0
  124. package/test-fixtures/punctuation/01/metadata.json +4 -0
  125. package/test-fixtures/punctuation/01/record.json +18 -0
  126. package/test-fixtures/punctuation/02/expectedResult.json +3 -0
  127. package/test-fixtures/punctuation/02/metadata.json +4 -0
  128. package/test-fixtures/punctuation/02/record.json +18 -0
  129. package/test-fixtures/punctuation/03/expectedResult.json +21 -0
  130. package/test-fixtures/punctuation/03/metadata.json +5 -0
  131. package/test-fixtures/punctuation/03/record.json +19 -0
  132. package/test-fixtures/punctuation/04/expectedResult.json +21 -0
  133. package/test-fixtures/punctuation/04/metadata.json +5 -0
  134. package/test-fixtures/punctuation/04/record.json +19 -0
  135. package/test-fixtures/punctuation/05/expectedResult.json +44 -0
  136. package/test-fixtures/punctuation/05/metadata.json +5 -0
  137. package/test-fixtures/punctuation/05/record.json +42 -0
  138. package/test-fixtures/resolvable-ext-references-melinda.js +0 -27
  139. package/.drone.yml +0 -93
@@ -1,151 +1,52 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import {expect} from 'chai';
31
2
  import {MarcRecord} from '@natlibfi/marc-record';
32
3
  import validatorFactory from './punctuation/';
33
-
34
- describe('punctuation', () => {
35
- it('Creates a validator', async () => {
36
- const validator = await validatorFactory();
37
-
38
- expect(validator)
39
- .to.be.an('object')
40
- .that.has.any.keys('description', 'validate');
41
-
42
- expect(validator.description).to.be.a('string');
43
- expect(validator.validate).to.be.a('function');
44
- });
45
-
46
- describe('#validate', () => {
47
- it('Finds the record valid', async () => {
48
- const validator = await validatorFactory();
49
- const record = new MarcRecord({
50
- fields: [
51
- {
52
- tag: '100',
53
- ind2: ' ',
54
- subfields: [
55
- {code: 'a', value: 'Sukunimi, Etunimi,'},
56
- {code: 'c', value: 'kirjoittaja.'}
57
- ]
58
- }
59
- ]
60
- });
61
- const result = await validator.validate(record);
62
-
63
- expect(result).to.eql({valid: true});
64
- });
65
-
66
- it('Finds the record invalid', async () => {
67
- const validator = await validatorFactory();
68
- const record = new MarcRecord({
69
- fields: [
70
- {
71
- tag: '100',
72
- ind2: ' ',
73
- subfields: [
74
- {code: 'a', value: 'Sukunimi, Etunimi'},
75
- {code: 'c', value: 'kirjoittaja.'}
76
- ]
77
- }
78
- ]
79
- });
80
- const result = await validator.validate(record);
81
-
82
- expect(result).to.eql({valid: false});
83
- });
84
- });
85
-
86
- describe('#fix', () => {
87
- it('Creates punctuation for field 100', async () => {
88
- const validator = await validatorFactory();
89
- const record = new MarcRecord({
90
- fields: [
91
- {
92
- tag: '100',
93
- ind1: ' ',
94
- ind2: ' ',
95
- subfields: [
96
- {code: 'a', value: 'Sukunimi, Etunimi'},
97
- {code: 'c', value: 'kirjoittaja'}
98
- ]
99
- }
100
- ]
101
- });
102
-
103
- await validator.fix(record);
104
-
105
- expect(record.fields).to.eql([
106
- {
107
- tag: '100',
108
- ind1: ' ',
109
- ind2: ' ',
110
- subfields: [
111
- {code: 'a', value: 'Sukunimi, Etunimi,'},
112
- {code: 'c', value: 'kirjoittaja.'}
113
- ]
114
- }
115
- ]);
116
- });
117
- });
118
-
119
- /*
120
- Describe('#fix', () => {
121
- it('Creates punctuation for field 264', async () => {
122
- const validator = await validatorFactory();
123
- const record = new MarcRecord({
124
- fields: [
125
- {
126
- tag: '264',
127
- ind1: ' ',
128
- ind2: ' ',
129
- subfields: [
130
- {code: 'b', value: 'Julkaisija'},
131
- {code: 'c', value: '2019'}
132
- ]
133
- }
134
- ]
135
- });
136
- await validator.fix(record);
137
- expect(record.fields).to.eql([
138
- {
139
- tag: '264',
140
- ind1: ' ',
141
- ind2: ' ',
142
- subfields: [
143
- {code: 'b', value: 'Julkaisija,'},
144
- {code: 'c', value: '2019.'}
145
- ]
146
- }
147
- ]);
148
- });
149
- });
150
- */
4
+ import {READERS} from '@natlibfi/fixura';
5
+ import generateTests from '@natlibfi/fixugen';
6
+ import createDebugLogger from 'debug';
7
+
8
+ generateTests({
9
+ callback,
10
+ path: [__dirname, '..', 'test-fixtures', 'punctuation'],
11
+ useMetadataFile: true,
12
+ recurse: false,
13
+ fixura: {
14
+ reader: READERS.JSON
15
+ },
16
+ mocha: {
17
+ before: () => testValidatorFactory()
18
+ }
151
19
  });
20
+ const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation:test');
21
+
22
+ async function testValidatorFactory() {
23
+ const validator = await validatorFactory();
24
+
25
+ expect(validator)
26
+ .to.be.an('object')
27
+ .that.has.any.keys('description', 'validate');
28
+
29
+ expect(validator.description).to.be.a('string');
30
+ expect(validator.validate).to.be.a('function');
31
+ }
32
+
33
+ async function callback({getFixture, enabled = true, fix = false}) {
34
+ if (enabled === false) {
35
+ debug('TEST SKIPPED!');
36
+ return;
37
+ }
38
+
39
+ const validator = await validatorFactory();
40
+ const record = new MarcRecord(getFixture('record.json'));
41
+ const expectedResult = getFixture('expectedResult.json');
42
+ // console.log(expectedResult); // eslint-disable-line
43
+
44
+ if (!fix) {
45
+ const result = await validator.validate(record);
46
+ expect(result).to.eql(expectedResult);
47
+ return;
48
+ }
49
+
50
+ await validator.fix(record);
51
+ expect(record).to.eql(expectedResult);
52
+ }
@@ -1,31 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
1
  import {parseString} from 'xml2js';
30
2
  import fetch from 'node-fetch';
31
3
 
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import chai from 'chai';
31
2
  import chaiAsPromised from 'chai-as-promised';
32
3
  import {MarcRecord} from '@natlibfi/marc-record';
@@ -63,7 +34,8 @@ describe('resolvable-ext-references-melinda', () => {
63
34
 
64
35
  it('Throws an error when prefixPattern not provided', async () => {
65
36
  const validator = await testContext.default({endpoint, prefixPattern, fields});
66
- await expect(validator.validate()).to.be.rejectedWith(Error, 'Cannot read property \'fields\' of undefined');
37
+ // Cannot read property 'fields' of undefined or Cannot read properties of undefined (reading 'fields')'
38
+ await expect(validator.validate()).to.be.rejectedWith(Error, /^Cannot read propert/u);
67
39
  });
68
40
 
69
41
  describe('#validate', () => {
package/src/sort-tags.js CHANGED
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import {MarcRecord} from '@natlibfi/marc-record';
31
2
 
32
3
  export default function (tagPattern) {
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import {expect} from 'chai';
31
2
  import {MarcRecord} from '@natlibfi/marc-record';
32
3
  import validatorFactory from '../src/sort-tags';
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2022 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  // Tag (RegExp): Pattern to match the field's tags Mandatory
31
2
  // ind1 (RegExp): Pattern to match the field's ind1 property
32
3
  // ind2 (RegExp): Pattern to match the field's ind2 property
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2022 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import {expect} from 'chai';
31
2
  //import chaiAsPromised from 'chai-as-promised';
32
3
  import {MarcRecord} from '@natlibfi/marc-record';
@@ -1,31 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * Melinda-related validators for @natlibfi/marc-record-validate
6
- *
7
- * Copyright (c) 2014-2017 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- **/
28
-
29
1
  const MAP_CONVERSION = {
30
2
 
31
3
  /**
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import chai from 'chai';
31
2
  import chaiAsPromised from 'chai-as-promised';
32
3
  import {MarcRecord} from '@natlibfi/marc-record';
package/src/urn.js CHANGED
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import fetch from 'node-fetch';
31
2
 
32
3
  const URN_GENERATOR_URL = 'http://generator.urn.fi/cgi-bin/urn_generator.cgi?type=nbn';
package/src/urn.spec.js CHANGED
@@ -1,32 +1,3 @@
1
- /**
2
- *
3
- * @licstart The following is the entire license notice for the JavaScript code in this file.
4
- *
5
- * MARC record validators used in Melinda
6
- *
7
- * Copyright (c) 2014-2020 University Of Helsinki (The National Library Of Finland)
8
- *
9
- * This file is part of marc-record-validators-melinda
10
- *
11
- * marc-record-validators-melinda program is free software: you can redistribute it and/or modify
12
- * it under the terms of the GNU Lesser General Public License as
13
- * published by the Free Software Foundation, either version 3 of the
14
- * License, or (at your option) any later version.
15
- *
16
- * marc-record-validators-melinda is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Lesser General Public License for more details.
20
- *
21
- * You should have received a copy of the GNU Lesser General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- *
24
- * @licend The above is the entire license notice
25
- * for the JavaScript code in this file.
26
- *
27
- */
28
-
29
-
30
1
  import {expect} from 'chai';
31
2
  import {MarcRecord} from '@natlibfi/marc-record';
32
3
  import validatorFactory from '../src/urn';
@@ -0,0 +1,3 @@
1
+ {
2
+ "valid": true
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "Validate - Finds the record valid",
3
+ "enabled": true
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "fields": [
3
+ {
4
+ "tag": "100",
5
+ "ind2": " ",
6
+ "subfields": [
7
+ {
8
+ "code": "a",
9
+ "value": "Sukunimi, Etunimi,"
10
+ },
11
+ {
12
+ "code": "c",
13
+ "value": "kirjoittaja."
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "valid": false
3
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "Validate - Finds the record invalid",
3
+ "enabled": true
4
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "fields": [
3
+ {
4
+ "tag": "100",
5
+ "ind2": " ",
6
+ "subfields": [
7
+ {
8
+ "code": "a",
9
+ "value": "Sukunimi, Etunimi"
10
+ },
11
+ {
12
+ "code": "c",
13
+ "value": "kirjoittaja."
14
+ }
15
+ ]
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "_validationOptions": {},
3
+ "leader": "",
4
+ "fields": [
5
+ {
6
+ "tag": "100",
7
+ "ind1": " ",
8
+ "ind2": " ",
9
+ "subfields": [
10
+ {
11
+ "code": "a",
12
+ "value": "Sukunimi, Etunimi,"
13
+ },
14
+ {
15
+ "code": "c",
16
+ "value": "kirjoittaja."
17
+ }
18
+ ]
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Fix - Creates punctuation for field 100",
3
+ "enabled": true,
4
+ "fix": true
5
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "fields": [
3
+ {
4
+ "tag": "100",
5
+ "ind1": " ",
6
+ "ind2": " ",
7
+ "subfields": [
8
+ {
9
+ "code": "a",
10
+ "value": "Sukunimi, Etunimi"
11
+ },
12
+ {
13
+ "code": "c",
14
+ "value": "kirjoittaja"
15
+ }
16
+ ]
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "_validationOptions": {},
3
+ "leader": "",
4
+ "fields": [
5
+ {
6
+ "tag": "264",
7
+ "ind1": " ",
8
+ "ind2": " ",
9
+ "subfields": [
10
+ {
11
+ "code": "b",
12
+ "value": "Julkaisija,"
13
+ },
14
+ {
15
+ "code": "c",
16
+ "value": "2019."
17
+ }
18
+ ]
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "description": "Fix - Creates punctuation for field 264$bc",
3
+ "enabled": true,
4
+ "fix": true
5
+ }