@natlibfi/marc-record-validators-melinda 12.0.0-alpha.9 → 12.0.1-alpha.1

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 (292) hide show
  1. package/dist/access-rights.test.js +1 -1
  2. package/dist/access-rights.test.js.map +1 -1
  3. package/dist/addMissingField337.test.js +1 -1
  4. package/dist/addMissingField337.test.js.map +1 -1
  5. package/dist/addMissingField338.test.js +1 -1
  6. package/dist/addMissingField338.test.js.map +1 -1
  7. package/dist/cyrillux-usemarcon-replacement.test.js +4 -7
  8. package/dist/cyrillux-usemarcon-replacement.test.js.map +2 -2
  9. package/dist/cyrillux.test.js +1 -1
  10. package/dist/cyrillux.test.js.map +1 -1
  11. package/dist/disambiguateSeriesStatements.test.js +1 -7
  12. package/dist/disambiguateSeriesStatements.test.js.map +2 -2
  13. package/dist/double-commas.test.js +1 -1
  14. package/dist/double-commas.test.js.map +1 -1
  15. package/dist/drop-terms.js +122 -0
  16. package/dist/drop-terms.js.map +7 -0
  17. package/dist/drop-terms.test.js +56 -0
  18. package/dist/drop-terms.test.js.map +7 -0
  19. package/dist/empty-fields.test.js +1 -1
  20. package/dist/empty-fields.test.js.map +1 -1
  21. package/dist/ending-punctuation.test.js +39 -19
  22. package/dist/ending-punctuation.test.js.map +2 -2
  23. package/dist/field-008-18-34-character-groups.test.js +2 -8
  24. package/dist/field-008-18-34-character-groups.test.js.map +2 -2
  25. package/dist/field-505-separators.test.js +1 -7
  26. package/dist/field-505-separators.test.js.map +2 -2
  27. package/dist/field-521-fix.test.js +1 -7
  28. package/dist/field-521-fix.test.js.map +2 -2
  29. package/dist/field-exclusion.test.js +11 -8
  30. package/dist/field-exclusion.test.js.map +2 -2
  31. package/dist/field-structure.test.js +1 -1
  32. package/dist/field-structure.test.js.map +1 -1
  33. package/dist/fields-present.test.js +1 -1
  34. package/dist/fields-present.test.js.map +1 -1
  35. package/dist/fix-33X.test.js +1 -1
  36. package/dist/fix-33X.test.js.map +1 -1
  37. package/dist/fix-country-codes.test.js +1 -7
  38. package/dist/fix-country-codes.test.js.map +2 -2
  39. package/dist/fix-sami-041.js +87 -0
  40. package/dist/fix-sami-041.js.map +7 -0
  41. package/dist/fix-sami-041.test.js +40 -0
  42. package/dist/fix-sami-041.test.js.map +7 -0
  43. package/dist/fixRelatorTerms.test.js +2 -8
  44. package/dist/fixRelatorTerms.test.js.map +2 -2
  45. package/dist/fixed-fields.test.js +29 -18
  46. package/dist/fixed-fields.test.js.map +2 -2
  47. package/dist/identical-fields.test.js +1 -1
  48. package/dist/identical-fields.test.js.map +1 -1
  49. package/dist/index.js +7 -1
  50. package/dist/index.js.map +2 -2
  51. package/dist/indicator-fixes.js +10 -0
  52. package/dist/indicator-fixes.js.map +2 -2
  53. package/dist/indicator-fixes.test.js +1 -7
  54. package/dist/indicator-fixes.test.js.map +2 -2
  55. package/dist/isbn-issn.js +1 -1
  56. package/dist/isbn-issn.js.map +2 -2
  57. package/dist/isbn-issn.test.js +9 -6
  58. package/dist/isbn-issn.test.js.map +2 -2
  59. package/dist/item-language.test.js +1 -1
  60. package/dist/item-language.test.js.map +2 -2
  61. package/dist/merge-fields.test.js +2 -7
  62. package/dist/merge-fields.test.js.map +2 -2
  63. package/dist/mergeField500Lisapainokset.test.js +1 -7
  64. package/dist/mergeField500Lisapainokset.test.js.map +2 -2
  65. package/dist/mergeRelatorTermFields.test.js +1 -7
  66. package/dist/mergeRelatorTermFields.test.js.map +2 -2
  67. package/dist/multiple-subfield-0.test.js +1 -7
  68. package/dist/multiple-subfield-0.test.js.map +2 -2
  69. package/dist/normalize-dashes.test.js +1 -7
  70. package/dist/normalize-dashes.test.js.map +2 -2
  71. package/dist/normalize-identifiers.test.js +1 -7
  72. package/dist/normalize-identifiers.test.js.map +2 -2
  73. package/dist/normalize-qualifying-information.test.js +1 -7
  74. package/dist/normalize-qualifying-information.test.js.map +2 -2
  75. package/dist/normalize-utf8-diacritics.test.js +1 -7
  76. package/dist/normalize-utf8-diacritics.test.js.map +2 -2
  77. package/dist/normalizeFieldForComparison.js +24 -0
  78. package/dist/normalizeFieldForComparison.js.map +2 -2
  79. package/dist/punctuation.test.js +1 -7
  80. package/dist/punctuation.test.js.map +2 -2
  81. package/dist/punctuation2.test.js +2 -8
  82. package/dist/punctuation2.test.js.map +2 -2
  83. package/dist/reindexSubfield6OccurenceNumbers.test.js +1 -7
  84. package/dist/reindexSubfield6OccurenceNumbers.test.js.map +2 -2
  85. package/dist/remove-041-zxx.js +56 -0
  86. package/dist/remove-041-zxx.js.map +7 -0
  87. package/dist/remove-041-zxx.test.js +40 -0
  88. package/dist/remove-041-zxx.test.js.map +7 -0
  89. package/dist/removeDuplicateDataFields.test.js +2 -8
  90. package/dist/removeDuplicateDataFields.test.js.map +2 -2
  91. package/dist/removeInferiorDataFields.js +1 -9
  92. package/dist/removeInferiorDataFields.js.map +2 -2
  93. package/dist/removeInferiorDataFields.test.js +1 -7
  94. package/dist/removeInferiorDataFields.test.js.map +2 -2
  95. package/dist/resolvable-ext-references-melinda.test.js +1 -1
  96. package/dist/resolvable-ext-references-melinda.test.js.map +2 -2
  97. package/dist/resolveOrphanedSubfield6s.js +1 -3
  98. package/dist/resolveOrphanedSubfield6s.js.map +2 -2
  99. package/dist/resolveOrphanedSubfield6s.test.js +1 -7
  100. package/dist/resolveOrphanedSubfield6s.test.js.map +2 -2
  101. package/dist/sanitize-vocabulary-source-codes.test.js +1 -7
  102. package/dist/sanitize-vocabulary-source-codes.test.js.map +2 -2
  103. package/dist/sort-tags.test.js +1 -1
  104. package/dist/sort-tags.test.js.map +1 -1
  105. package/dist/sortFields.js +16 -1
  106. package/dist/sortFields.js.map +2 -2
  107. package/dist/sortFields.test.js +1 -7
  108. package/dist/sortFields.test.js.map +2 -2
  109. package/dist/sortRelatorTerms.test.js +1 -7
  110. package/dist/sortRelatorTerms.test.js.map +2 -2
  111. package/dist/sortSubfields.js +3 -1
  112. package/dist/sortSubfields.js.map +2 -2
  113. package/dist/sortSubfields.test.js +1 -7
  114. package/dist/sortSubfields.test.js.map +2 -2
  115. package/dist/stripPunctuation.js +7 -4
  116. package/dist/stripPunctuation.js.map +2 -2
  117. package/dist/stripPunctuation.test.js +1 -7
  118. package/dist/stripPunctuation.test.js.map +2 -2
  119. package/dist/subfield-exclusion.test.js +1 -1
  120. package/dist/subfield-exclusion.test.js.map +1 -1
  121. package/dist/subfield6Utils.js +1 -13
  122. package/dist/subfield6Utils.js.map +2 -2
  123. package/dist/subfieldValueNormalizations.test.js +1 -7
  124. package/dist/subfieldValueNormalizations.test.js.map +2 -2
  125. package/dist/sync-007-and-300.test.js +1 -7
  126. package/dist/sync-007-and-300.test.js.map +2 -2
  127. package/dist/sync-language.js +103 -0
  128. package/dist/sync-language.js.map +7 -0
  129. package/dist/sync-language.test.js +40 -0
  130. package/dist/sync-language.test.js.map +7 -0
  131. package/dist/translate-terms.js +121 -85
  132. package/dist/translate-terms.js.map +3 -3
  133. package/dist/translate-terms.test.js +5 -8
  134. package/dist/translate-terms.test.js.map +2 -2
  135. package/dist/unicode-decomposition.test.js +1 -1
  136. package/dist/unicode-decomposition.test.js.map +1 -1
  137. package/dist/update-field-540.test.js +2 -8
  138. package/dist/update-field-540.test.js.map +2 -2
  139. package/dist/urn.test.js +2 -8
  140. package/dist/urn.test.js.map +2 -2
  141. package/package.json +18 -16
  142. package/src/access-rights.test.js +1 -1
  143. package/src/addMissingField337.test.js +1 -1
  144. package/src/addMissingField338.test.js +1 -1
  145. package/src/cyrillux-usemarcon-replacement.test.js +4 -9
  146. package/src/cyrillux.test.js +1 -1
  147. package/src/disambiguateSeriesStatements.test.js +3 -8
  148. package/src/double-commas.test.js +1 -1
  149. package/src/drop-terms.js +162 -0
  150. package/src/drop-terms.test.js +81 -0
  151. package/src/empty-fields.test.js +1 -1
  152. package/src/ending-punctuation.test.js +28 -20
  153. package/src/field-008-18-34-character-groups.test.js +4 -9
  154. package/src/field-505-separators.test.js +3 -8
  155. package/src/field-521-fix.test.js +3 -8
  156. package/src/field-exclusion.test.js +10 -8
  157. package/src/field-structure.test.js +1 -1
  158. package/src/fields-present.test.js +1 -1
  159. package/src/fix-33X.test.js +1 -1
  160. package/src/fix-country-codes.test.js +3 -8
  161. package/src/fix-sami-041.js +113 -0
  162. package/src/fix-sami-041.test.js +52 -0
  163. package/src/fixRelatorTerms.test.js +4 -9
  164. package/src/fixed-fields.test.js +24 -18
  165. package/src/identical-fields.test.js +1 -1
  166. package/src/index.js +8 -1
  167. package/src/indicator-fixes.js +12 -0
  168. package/src/indicator-fixes.test.js +3 -8
  169. package/src/isbn-issn.js +1 -1
  170. package/src/isbn-issn.test.js +8 -6
  171. package/src/item-language.test.js +2 -2
  172. package/src/merge-fields.test.js +3 -8
  173. package/src/mergeField500Lisapainokset.test.js +3 -8
  174. package/src/mergeRelatorTermFields.test.js +3 -8
  175. package/src/multiple-subfield-0.test.js +3 -8
  176. package/src/normalize-dashes.test.js +3 -8
  177. package/src/normalize-identifiers.test.js +3 -8
  178. package/src/normalize-qualifying-information.test.js +3 -8
  179. package/src/normalize-utf8-diacritics.test.js +3 -8
  180. package/src/normalizeFieldForComparison.js +26 -0
  181. package/src/punctuation.test.js +3 -8
  182. package/src/punctuation2.test.js +4 -9
  183. package/src/reindexSubfield6OccurenceNumbers.test.js +3 -8
  184. package/src/remove-041-zxx.js +85 -0
  185. package/src/remove-041-zxx.test.js +52 -0
  186. package/src/removeDuplicateDataFields.test.js +4 -9
  187. package/src/removeInferiorDataFields.js +7 -7
  188. package/src/removeInferiorDataFields.test.js +3 -8
  189. package/src/resolvable-ext-references-melinda.test.js +5 -5
  190. package/src/resolveOrphanedSubfield6s.js +3 -3
  191. package/src/resolveOrphanedSubfield6s.test.js +3 -8
  192. package/src/sanitize-vocabulary-source-codes.test.js +3 -8
  193. package/src/sort-tags.test.js +1 -1
  194. package/src/sortFields.js +20 -1
  195. package/src/sortFields.test.js +3 -8
  196. package/src/sortRelatorTerms.test.js +3 -8
  197. package/src/sortSubfields.js +3 -1
  198. package/src/sortSubfields.test.js +3 -8
  199. package/src/stripPunctuation.js +9 -6
  200. package/src/stripPunctuation.test.js +3 -8
  201. package/src/subfield-exclusion.test.js +1 -1
  202. package/src/subfield6Utils.js +13 -13
  203. package/src/subfieldValueNormalizations.test.js +3 -8
  204. package/src/sync-007-and-300.test.js +3 -8
  205. package/src/sync-language.js +148 -0
  206. package/src/sync-language.test.js +52 -0
  207. package/src/translate-terms.js +158 -103
  208. package/src/translate-terms.test.js +12 -16
  209. package/src/unicode-decomposition.test.js +1 -1
  210. package/src/update-field-540.test.js +4 -9
  211. package/src/urn.test.js +4 -9
  212. package/test-fixtures/drop-terms/01/expectedResult.json +31 -0
  213. package/test-fixtures/drop-terms/01/metadata.json +6 -0
  214. package/test-fixtures/drop-terms/01/record.json +35 -0
  215. package/test-fixtures/drop-terms/02/expectedResult.json +7 -0
  216. package/test-fixtures/drop-terms/02/metadata.json +6 -0
  217. package/test-fixtures/drop-terms/02/record.json +40 -0
  218. package/test-fixtures/drop-terms/03/expectedResult.json +6 -0
  219. package/test-fixtures/drop-terms/03/metadata.json +18 -0
  220. package/test-fixtures/drop-terms/03/record.json +39 -0
  221. package/test-fixtures/drop-terms/04/expectedResult.json +6 -0
  222. package/test-fixtures/drop-terms/04/metadata.json +19 -0
  223. package/test-fixtures/drop-terms/04/record.json +24 -0
  224. package/test-fixtures/fix-language-codes/02/metadata.json +1 -1
  225. package/test-fixtures/fix-sami-041/01/expectedResult.json +6 -0
  226. package/test-fixtures/fix-sami-041/01/metadata.json +4 -0
  227. package/test-fixtures/fix-sami-041/01/record.json +13 -0
  228. package/test-fixtures/fix-sami-041/02/expectedResult.json +10 -0
  229. package/test-fixtures/fix-sami-041/02/metadata.json +4 -0
  230. package/test-fixtures/fix-sami-041/02/record.json +8 -0
  231. package/test-fixtures/fix-sami-041/03/expectedResult.json +5 -0
  232. package/test-fixtures/fix-sami-041/03/metadata.json +5 -0
  233. package/test-fixtures/fix-sami-041/03/record.json +8 -0
  234. package/test-fixtures/fix-sami-041/04/expectedResult.json +7 -0
  235. package/test-fixtures/fix-sami-041/04/metadata.json +4 -0
  236. package/test-fixtures/fix-sami-041/04/record.json +10 -0
  237. package/test-fixtures/fix-sami-041/05/expectedResult.json +10 -0
  238. package/test-fixtures/fix-sami-041/05/metadata.json +6 -0
  239. package/test-fixtures/fix-sami-041/05/record.json +8 -0
  240. package/test-fixtures/indicator-fixes/11/expectedResult.json +10 -0
  241. package/test-fixtures/indicator-fixes/11/metadata.json +4 -0
  242. package/test-fixtures/indicator-fixes/11/record.json +10 -0
  243. package/test-fixtures/merge-fields/f05/metadata.json +1 -1
  244. package/test-fixtures/remove-041-zxx/01/expectedResult.json +5 -0
  245. package/test-fixtures/remove-041-zxx/01/metadata.json +5 -0
  246. package/test-fixtures/remove-041-zxx/01/record.json +10 -0
  247. package/test-fixtures/remove-041-zxx/02/expectedResult.json +7 -0
  248. package/test-fixtures/remove-041-zxx/02/metadata.json +5 -0
  249. package/test-fixtures/remove-041-zxx/02/record.json +9 -0
  250. package/test-fixtures/remove-041-zxx/11/expectedResult.json +10 -0
  251. package/test-fixtures/remove-041-zxx/11/metadata.json +5 -0
  252. package/test-fixtures/remove-041-zxx/11/record.json +9 -0
  253. package/test-fixtures/remove-041-zxx/12/expectedResult.json +10 -0
  254. package/test-fixtures/remove-041-zxx/12/metadata.json +5 -0
  255. package/test-fixtures/remove-041-zxx/12/record.json +9 -0
  256. package/test-fixtures/sort-fields/15/input.json +9 -0
  257. package/test-fixtures/sort-fields/15/metadata.json +5 -0
  258. package/test-fixtures/sort-fields/15/result.json +10 -0
  259. package/test-fixtures/sync-language/01/expectedResult.json +5 -0
  260. package/test-fixtures/sync-language/01/metadata.json +5 -0
  261. package/test-fixtures/sync-language/01/record.json +7 -0
  262. package/test-fixtures/sync-language/02/expectedResult.json +6 -0
  263. package/test-fixtures/sync-language/02/metadata.json +5 -0
  264. package/test-fixtures/sync-language/02/record.json +10 -0
  265. package/test-fixtures/sync-language/03/expectedResult.json +6 -0
  266. package/test-fixtures/sync-language/03/metadata.json +5 -0
  267. package/test-fixtures/sync-language/03/record.json +6 -0
  268. package/test-fixtures/sync-language/10/expectedResult.json +10 -0
  269. package/test-fixtures/sync-language/10/metadata.json +5 -0
  270. package/test-fixtures/sync-language/10/record.json +8 -0
  271. package/test-fixtures/sync-language/11/expectedResult.json +10 -0
  272. package/test-fixtures/sync-language/11/metadata.json +5 -0
  273. package/test-fixtures/sync-language/11/record.json +7 -0
  274. package/test-fixtures/sync-language/12/expectedResult.json +9 -0
  275. package/test-fixtures/sync-language/12/metadata.json +6 -0
  276. package/test-fixtures/sync-language/12/record.json +6 -0
  277. package/test-fixtures/sync-language/13/expectedResult.json +10 -0
  278. package/test-fixtures/sync-language/13/metadata.json +5 -0
  279. package/test-fixtures/sync-language/13/record.json +8 -0
  280. package/test-fixtures/sync-language/14/expectedResult.json +9 -0
  281. package/test-fixtures/sync-language/14/metadata.json +5 -0
  282. package/test-fixtures/sync-language/14/record.json +7 -0
  283. package/test-fixtures/sync-language/15/expectedResult.json +9 -0
  284. package/test-fixtures/sync-language/15/metadata.json +5 -0
  285. package/test-fixtures/sync-language/15/record.json +7 -0
  286. package/test-fixtures/translate-terms/05/expectedResult.json +12 -0
  287. package/test-fixtures/translate-terms/05/metadata.json +7 -0
  288. package/test-fixtures/translate-terms/05/record.json +11 -0
  289. package/test-fixtures/translate-terms/06/expectedResult.json +12 -0
  290. package/test-fixtures/translate-terms/06/metadata.json +7 -0
  291. package/test-fixtures/translate-terms/06/record.json +11 -0
  292. package/test-fixtures/translate-terms-data.js +23 -0
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './normalize-identifiers.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-identifiers:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-identifiers:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './normalize-qualifying-information.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-qualifying-information:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-qualifying-information:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './normalize-utf8-diacritics.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -20,7 +20,7 @@ generateTests({
20
20
  }
21
21
  });
22
22
 
23
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-utf8-diacritics:test');
23
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-utf8-diacritics:test');
24
24
 
25
25
  async function testValidatorFactory() {
26
26
  const validator = await validatorFactory();
@@ -30,12 +30,7 @@ async function testValidatorFactory() {
30
30
  assert.equal(typeof validator.validate, 'function');
31
31
  }
32
32
 
33
- async function callback({getFixture, enabled = true, fix = false}) {
34
- if (enabled === false) {
35
- debug('TEST SKIPPED!');
36
- return;
37
- }
38
-
33
+ async function callback({getFixture, fix = false}) {
39
34
  const validator = await validatorFactory();
40
35
  const record = new MarcRecord(getFixture('record.json'));
41
36
  const expectedResult = getFixture('expectedResult.json');
@@ -19,6 +19,9 @@ const debug = createDebugLogger('@natlibfi/melinda-marc-record-merge-reducers:no
19
19
  const debugDev = debug.extend('dev');
20
20
 
21
21
  export function isEnnakkotietoSubfieldG(subfield) {
22
+ if (valuelessSubfield(subfield)) {
23
+ return false;
24
+ }
22
25
  if (subfield.code !== 'g') {
23
26
  return false;
24
27
  }
@@ -116,6 +119,9 @@ function subfieldValueLowercase(value, subfieldCode, tag) {
116
119
  }
117
120
 
118
121
  function subfieldLowercase(sf, tag) {
122
+ if (valuelessSubfield(sf)) {
123
+ return;
124
+ }
119
125
  sf.value = subfieldValueLowercase(sf.value, sf.code, tag);
120
126
  }
121
127
 
@@ -148,6 +154,10 @@ function hack490SubfieldA(field) {
148
154
 
149
155
  // NB! This won't work, if the punctuation has not been stripped beforehand!
150
156
  function removeSarja(subfield) {
157
+ if (valuelessSubfield(subfield)) {
158
+ return;
159
+ }
160
+
151
161
  if (subfield.code !== 'a') {
152
162
  return;
153
163
  }
@@ -188,6 +198,9 @@ function normalizeISBN(field) {
188
198
  relevantSubfields.forEach(sf => normalizeIsbnSubfield(sf));
189
199
 
190
200
  function normalizeIsbnSubfield(sf) {
201
+ if (valuelessSubfield(sf)) {
202
+ return;
203
+ }
191
204
  //nvdebug(` ISBN-subfield? ${subfieldToString(sf)}`);
192
205
  sf.value = sf.value.replace(/-/ug, '');
193
206
  sf.value = sf.value.replace(/x/u, 'X');
@@ -202,6 +215,9 @@ function fieldSpecificHacks(field) {
202
215
 
203
216
  export function fieldTrimSubfieldValues(field) {
204
217
  field.subfields?.forEach((sf) => {
218
+ if (valuelessSubfield(sf)) {
219
+ return;
220
+ }
205
221
  sf.value = sf.value.replace(/^[ \t\n]+/u, '');
206
222
  sf.value = sf.value.replace(/[ \t\n]+$/u, '');
207
223
  sf.value = sf.value.replace(/[ \t\n]+/gu, ' ');
@@ -212,6 +228,9 @@ function fieldRemoveDecomposedDiacritics(field) {
212
228
  // Raison d'être/motivation: "Sirén" and diacriticless "Siren" might refer to a same surname, so this normalization
213
229
  // allows us to compare authors and avoid duplicate fields.
214
230
  field.subfields.forEach((sf) => {
231
+ if (valuelessSubfield(sf)) {
232
+ return;
233
+ }
215
234
  sf.value = removeDecomposedDiacritics(sf.value);
216
235
  });
217
236
  }
@@ -297,6 +316,9 @@ export function cloneAndNormalizeFieldForComparison(field) {
297
316
  return clonedField;
298
317
  }
299
318
  clonedField.subfields.forEach((sf) => { // Do this for all fields or some fields?
319
+ if (valuelessSubfield(sf)) {
320
+ return;
321
+ }
300
322
  sf.value = normalizeSubfieldValue(sf.value, sf.code, field.tag);
301
323
  sf.value = removeCharsThatDontCarryMeaning(sf.value, field.tag, sf.code);
302
324
  });
@@ -318,3 +340,7 @@ function fieldSkipNormalization(field) {
318
340
  }
319
341
  return false;
320
342
  }
343
+
344
+ function valuelessSubfield(sf) {
345
+ return sf.value === undefined;
346
+ }
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './punctuation/index.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -1,9 +1,9 @@
1
1
  import assert from 'node:assert';
2
2
  import {MarcRecord} from '@natlibfi/marc-record';
3
- import validatorFactory from '../src/punctuation2.js';
3
+ import validatorFactory from './punctuation2.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation2:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/punctuation2:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './reindexSubfield6OccurenceNumbers.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/reindexSubfield6OccurrenceNumbers:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/reindexSubfield6OccurrenceNumbers:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -0,0 +1,85 @@
1
+ /*
2
+ // remove-041-zxx.js
3
+ //
4
+ // https://wiki.helsinki.fi/xwiki/bin/view/rdasovellusohje/RDA-kuvailu%20MARC%2021%20-formaatilla/RDA-sovellusohje/008%20Kontrollikentt%C3%A4/#Hmp.35-37Kieli
5
+ // "008-kielikoodi on sama kuin ensimmäinen 041-kentän a- (tai d-) osakenttä. Poikkeuksen muodostaa koodi zxx:
6
+ // jos tietueen 008ssa on kielikoodi zxx (ei kielellistä sisältöä, esim. soitinmusiikki), tietueessa ei voi olla 041 a- eikä d-osakenttää."
7
+ // Effectively this means, that 'zxx' does not appear in 041!
8
+ // Author(s): Nicholas Volk
9
+ */
10
+
11
+ //import createDebugLogger from 'debug';
12
+ import clone from 'clone';
13
+
14
+ import {fieldToString} from './utils.js';
15
+
16
+ // const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:remove-041-zxx');
17
+
18
+
19
+
20
+
21
+ export default function () {
22
+
23
+ return {
24
+ description: "Remove 'zxx' from f041",
25
+ validate, fix
26
+ };
27
+
28
+ function zxxRemoval041(record, validateMode) {
29
+ const fields041 = record.fields.filter(f => f.tag === '041');
30
+
31
+ return handleZxx(fields041);
32
+
33
+ function handleZxx(fields, result = []) {
34
+ const [currField, ...remainingFields] = fields;
35
+ if ( !currField) {
36
+ return result;
37
+ }
38
+ // Theoretically 'zxx' might mean something in ISO-639-3 or some other language code list:
39
+ if (!currField.subfields || currField.subfields.some(sf => sf.code === '2')) {
40
+ return handleZxx(remainingFields, result);
41
+ }
42
+ // Presumable 'zxx' is bad in any data subfield, not just 'a' and 'd':
43
+ const otherSubfields = currField.subfields.filter(sf => (!sf.code.match(/^[a-z]$/u) || sf.value !== 'zxx'));
44
+ if (otherSubfields.length === currField.subfields.length) {
45
+ return handleZxx(remainingFields, result);
46
+ }
47
+ const originalString = fieldToString(currField);
48
+ if (otherSubfields.length === 0) {
49
+ const message = `Remove '${originalString}'`;
50
+ if (!validateMode) {
51
+ record.removeField(currField);
52
+ }
53
+ return handleZxx(remainingFields, [...result, message]);
54
+ }
55
+ // Some subfields are removed:
56
+ if (validateMode) {
57
+ // NB! In validation field is not really deleted, and the non-deleted field might trigger other fixes (than won't be done to a deleted field) later on
58
+ const clonedField = clone(currField);
59
+ clonedField.subfields = otherSubfields;
60
+ const modifiedString = fieldToString(clonedField);
61
+ const message = `Modify '${originalString}' => '${modifiedString}`;
62
+ return handleZxx(remainingFields, [...result, message]);
63
+ }
64
+ currField.subfields = otherSubfields;
65
+ const modifiedString = fieldToString(currField);
66
+ const message = `Modify '${originalString}' => '${modifiedString}`;
67
+ return handleZxx(remainingFields, [...result, message]);
68
+ }
69
+ }
70
+
71
+ function fix(record, validateMode = false) {
72
+ const messages = zxxRemoval041(record, validateMode);
73
+
74
+ if (validateMode) {
75
+ return {message: messages, valid: messages.length === 0};
76
+ }
77
+ return {message: [], fix: messages, valid: true};
78
+ }
79
+
80
+
81
+ function validate(record) {
82
+ return fix(record, true);
83
+ }
84
+ }
85
+
@@ -0,0 +1,52 @@
1
+ import assert from 'node:assert/strict';
2
+ //import createDebugLogger from 'debug';
3
+
4
+ import validatorFactory from './remove-041-zxx.js';
5
+
6
+ import {MarcRecord} from '@natlibfi/marc-record';
7
+ import {READERS} from '@natlibfi/fixura';
8
+ import generateTests from '@natlibfi/fixugen';
9
+
10
+ generateTests({
11
+ callback,
12
+ path: [import.meta.dirname, '..', 'test-fixtures', 'remove-041-zxx'],
13
+ useMetadataFile: true,
14
+ recurse: false,
15
+ fixura: {
16
+ reader: READERS.JSON
17
+ },
18
+ hooks: {
19
+ before: async () => {
20
+ testValidatorFactory();
21
+ }
22
+ }
23
+ });
24
+
25
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/drop-terms:test');
26
+
27
+ async function testValidatorFactory() {
28
+ const validator = await validatorFactory();
29
+
30
+ assert.equal(typeof validator, 'object');
31
+ assert.equal(typeof validator.description, 'string');
32
+ assert.equal(typeof validator.validate, 'function');
33
+ }
34
+
35
+ async function callback({getFixture, fix = false}) {
36
+ const validator = await validatorFactory();
37
+ const record = new MarcRecord(getFixture('record.json'));
38
+ const expectedResult = getFixture('expectedResult.json');
39
+ //const expectedResult = new MarcRecord(getFixture('expectedResult.json'));
40
+ // console.log(expectedResult); // eslint-disable-line
41
+
42
+ if (!fix) {
43
+ const result = await validator.validate(record);
44
+ assert.deepEqual(result, expectedResult);
45
+ const originalRecord = new MarcRecord(getFixture('record.json'));
46
+ assert.deepEqual(record, originalRecord); // Validation should not change the record
47
+ return;
48
+ }
49
+
50
+ await validator.fix(record);
51
+ assert.deepEqual(record, new MarcRecord(expectedResult));
52
+ }
@@ -1,9 +1,9 @@
1
1
  import assert from 'node:assert';
2
2
  import {MarcRecord} from '@natlibfi/marc-record';
3
- import validatorFactory from '../src/removeDuplicateDataFields.js';
3
+ import validatorFactory from './removeDuplicateDataFields.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/removeDuplicateDataFields:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/removeDuplicateDataFields:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
  const record = new MarcRecord(getFixture('record.json'));
40
35
  const expectedResult = getFixture('expectedResult.json');
@@ -1,7 +1,7 @@
1
- import createDebugLogger from 'debug';
1
+ //import createDebugLogger from 'debug';
2
2
  import {fieldToChain, sameField} from './removeDuplicateDataFields.js';
3
3
  import {fieldGetOccurrenceNumberPairs, fieldHasValidSubfield6, fieldSevenToOneOccurrenceNumber, fieldsToNormalizedString} from './subfield6Utils.js';
4
- import {fieldHasSubfield, fieldsToString, fieldToString, nvdebug, uniqArray} from './utils.js';
4
+ import {fieldHasSubfield, fieldsToString, fieldToString, /*nvdebug,*/ uniqArray} from './utils.js';
5
5
  import {fieldHasValidSubfield8} from './subfield8Utils.js';
6
6
  import {encodingLevelIsBetterThanPrepublication, fieldRefersToKoneellisestiTuotettuTietue, getEncodingLevel} from './prepublicationUtils.js';
7
7
  import {cloneAndNormalizeFieldForComparison} from './normalizeFieldForComparison.js';
@@ -12,7 +12,7 @@ import {fixComposition, precomposeFinnishLetters} from './normalize-utf8-diacrit
12
12
  // NB! This validator handles only full fields, and does not support subfield $8 removal.
13
13
  // Also, having multiple $8 subfields in same fields is not supported.
14
14
  // If this functionality is needed, see removeDuplicateDatafields.js for examples of subfield-only stuff.
15
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:removeInferiorDataFields');
15
+ // const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:removeInferiorDataFields');
16
16
 
17
17
  export default function () {
18
18
  return {
@@ -21,7 +21,7 @@ export default function () {
21
21
  };
22
22
 
23
23
  function fix(record) {
24
- nvdebug('Fix record: remove inferior (eg. subset) data fields', debug);
24
+ //nvdebug('Fix record: remove inferior (eg. subset) data fields', debug);
25
25
  const res = {message: [], fix: [], valid: true};
26
26
  removeInferiorDatafields(record, true);
27
27
  // This can not really fail...
@@ -30,7 +30,7 @@ export default function () {
30
30
 
31
31
  function validate(record) {
32
32
  // Check max, and check number of different indexes
33
- nvdebug('Validate record: remove inferior (eg. subset) data fields', debug);
33
+ //nvdebug('Validate record: remove inferior (eg. subset) data fields', debug);
34
34
 
35
35
  const duplicates = removeInferiorDatafields(record, false);
36
36
 
@@ -444,8 +444,8 @@ export function removeInferiorDatafields(record, fix = true) {
444
444
  const removables6 = removeInferiorChains(record, fix); // Lone subfield $6 chains
445
445
  // HOW TO HANDLE $6+$8 combos? Skipping is relatively OK.
446
446
 
447
- nvdebug(`REMOVABLES:\n ${removables.join('\n ')}`, debug);
448
- nvdebug(`REMOVABLES 6:\n ${removables6.join('\n ')}`, debug);
447
+ //nvdebug(`REMOVABLES:\n ${removables.join('\n ')}`, debug);
448
+ //nvdebug(`REMOVABLES 6:\n ${removables6.join('\n ')}`, debug);
449
449
 
450
450
  const removablesAll = removables.concat(removables6); //.concat(removables8);
451
451
 
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './removeInferiorDataFields.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -20,7 +20,7 @@ generateTests({
20
20
  }
21
21
  });
22
22
 
23
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/removeInferiorDataFields:test');
23
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/removeInferiorDataFields:test');
24
24
 
25
25
  async function testValidatorFactory() {
26
26
  const validator = await validatorFactory();
@@ -30,12 +30,7 @@ async function testValidatorFactory() {
30
30
  assert.equal(typeof validator.validate).to.be.a('function');
31
31
  }
32
32
 
33
- async function callback({getFixture, enabled = true, fix = false}) {
34
- if (enabled === false) {
35
- debug('TEST SKIPPED!');
36
- return;
37
- }
38
-
33
+ async function callback({getFixture, fix = false}) {
39
34
  const validator = await validatorFactory();
40
35
  const record = new MarcRecord(getFixture('record.json'));
41
36
  const expectedResult = getFixture('expectedResult.json');
@@ -3,7 +3,7 @@ import assert from 'node:assert';
3
3
  //import chaiAsPromised from 'chai-as-promised';
4
4
  import {MarcRecord} from '@natlibfi/marc-record';
5
5
  import fetchMock from 'fetch-mock';
6
- import * as testContext from '../src/resolvable-ext-references-melinda.js';
6
+ import * as testContext from './resolvable-ext-references-melinda.js';
7
7
  import {fixture5000, fixture9550, fixture1000} from '../test-fixtures/resolvable-ext-references-melinda.js';
8
8
  import {afterEach, beforeEach, describe, it} from 'node:test';
9
9
 
@@ -27,9 +27,9 @@ describe('resolvable-ext-references-melinda', () => {
27
27
 
28
28
  beforeEach(() => {
29
29
  fetchMock.mockGlobal(); // replace fetch with fetch-mock's implementation
30
- fetchMock.get(`${endpoint}${queryParam}5000`, { status: 200, headers: {}, body: fixture5000 })
31
- .get(`${endpoint}${queryParam}9550`, { status: 200, headers: {}, body: fixture9550 })
32
- .get(`${endpoint}${queryParam}1000`, { status: 200, headers: {}, body: fixture1000 });
30
+ fetchMock.get(`${endpoint}${queryParam}5000`, {status: 200, headers: {}, body: fixture5000})
31
+ .get(`${endpoint}${queryParam}9550`, {status: 200, headers: {}, body: fixture9550})
32
+ .get(`${endpoint}${queryParam}1000`, {status: 200, headers: {}, body: fixture1000});
33
33
 
34
34
  });
35
35
 
@@ -50,7 +50,7 @@ describe('resolvable-ext-references-melinda', () => {
50
50
  }
51
51
  catch (err) {
52
52
  assert.equal(err instanceof Error, true);
53
- assert.match(err.message, /^Cannot read propert/u) ;
53
+ assert.match(err.message, /^Cannot read propert/u);
54
54
  }
55
55
  //await assert(validator.validate()).to.be.rejectedWith(Error, /^Cannot read propert/u);
56
56
  });
@@ -1,5 +1,5 @@
1
1
  import createDebugLogger from 'debug';
2
- import {fieldHasSubfield, fieldToString, nvdebug, subfieldToString} from './utils.js';
2
+ import {fieldHasSubfield, fieldToString, nvdebug /*, subfieldToString*/ } from './utils.js';
3
3
  import {fieldHasWantedTagAndOccurrenceNumber, isValidSubfield6, subfield6GetOccurrenceNumber, subfield6ResetOccurrenceNumber} from './subfield6Utils.js';
4
4
 
5
5
  // Relocated from melinda-marc-record-merge-reducers (and renamed)
@@ -77,7 +77,7 @@ function findPairForSubfield6OccurrenceNumber(subfield6, myTag, candPairFields)
77
77
  if (!isValidSubfield6(subfield6)) {
78
78
  return undefined;
79
79
  }
80
- nvdebug(`LOOKING FOR PAIR: ${myTag} ${subfieldToString(subfield6)}`);
80
+ //nvdebug(`LOOKING FOR PAIR: ${myTag} ${subfieldToString(subfield6)}`);
81
81
  candPairFields.forEach(field => fieldToString(field));
82
82
 
83
83
  // Only valid $6 value that fails to map to another field is iffy...
@@ -88,7 +88,7 @@ function findPairForSubfield6OccurrenceNumber(subfield6, myTag, candPairFields)
88
88
  return undefined;
89
89
  }
90
90
  const tagAndOccurrenceNumber = `${myTag}-${occurrenceNumber}`;
91
- nvdebug(`Try to find occurrence number ${tagAndOccurrenceNumber} in field ${referredTag}...`);
91
+ //nvdebug(`Try to find occurrence number ${tagAndOccurrenceNumber} in field ${referredTag}...`);
92
92
  //const relevantFields = fields.filter(field => field.tag === referredTag && field.subfields.some(sf => subfield6GetOccurrenceNumber(sf) === occurrenceNumber));
93
93
  const relevantFields = candPairFields.filter(field => field.tag === referredTag && fieldHasWantedTagAndOccurrenceNumber(field, tagAndOccurrenceNumber));
94
94
  if (relevantFields.length === 0) {
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './resolveOrphanedSubfield6s.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -20,7 +20,7 @@ generateTests({
20
20
  }
21
21
  });
22
22
 
23
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/resolveOrphanedSubfield6s:test');
23
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/resolveOrphanedSubfield6s:test');
24
24
 
25
25
  async function testValidatorFactory() {
26
26
  const validator = await validatorFactory();
@@ -30,12 +30,7 @@ async function testValidatorFactory() {
30
30
  assert.equal(typeof validator.validate, 'function');
31
31
  }
32
32
 
33
- async function callback({getFixture, enabled = true, fix = false}) {
34
- if (enabled === false) {
35
- debug('TEST SKIPPED!');
36
- return;
37
- }
38
-
33
+ async function callback({getFixture, fix = false}) {
39
34
  const validator = await validatorFactory();
40
35
  const record = new MarcRecord(getFixture('record.json'));
41
36
  const expectedResult = getFixture('expectedResult.json');
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
3
3
  import validatorFactory from './sanitize-vocabulary-source-codes.js';
4
4
  import {READERS} from '@natlibfi/fixura';
5
5
  import generateTests from '@natlibfi/fixugen';
6
- import createDebugLogger from 'debug';
6
+ //import createDebugLogger from 'debug';
7
7
 
8
8
  generateTests({
9
9
  callback,
@@ -19,7 +19,7 @@ generateTests({
19
19
  }
20
20
  }
21
21
  });
22
- const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/sanitize-vocabulary-source-codes:test');
22
+ //const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/sanitize-vocabulary-source-codes:test');
23
23
 
24
24
  async function testValidatorFactory() {
25
25
  const validator = await validatorFactory();
@@ -29,12 +29,7 @@ async function testValidatorFactory() {
29
29
  assert.equal(typeof validator.validate, 'function');
30
30
  }
31
31
 
32
- async function callback({getFixture, enabled = true, fix = false}) {
33
- if (enabled === false) {
34
- debug('TEST SKIPPED!');
35
- return;
36
- }
37
-
32
+ async function callback({getFixture, fix = false}) {
38
33
  const validator = await validatorFactory();
39
34
 
40
35
  const recordFixture = getFixture('record.json');
@@ -1,6 +1,6 @@
1
1
  import assert from 'node:assert';
2
2
  import {MarcRecord} from '@natlibfi/marc-record';
3
- import validatorFactory from '../src/sort-tags.js';
3
+ import validatorFactory from './sort-tags.js';
4
4
  import {describe, it} from 'node:test';
5
5
 
6
6
  describe('sort-tags', () => {