@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.
- package/dist/access-rights.test.js +1 -1
- package/dist/access-rights.test.js.map +1 -1
- package/dist/addMissingField337.test.js +1 -1
- package/dist/addMissingField337.test.js.map +1 -1
- package/dist/addMissingField338.test.js +1 -1
- package/dist/addMissingField338.test.js.map +1 -1
- package/dist/cyrillux-usemarcon-replacement.test.js +4 -7
- package/dist/cyrillux-usemarcon-replacement.test.js.map +2 -2
- package/dist/cyrillux.test.js +1 -1
- package/dist/cyrillux.test.js.map +1 -1
- package/dist/disambiguateSeriesStatements.test.js +1 -7
- package/dist/disambiguateSeriesStatements.test.js.map +2 -2
- package/dist/double-commas.test.js +1 -1
- package/dist/double-commas.test.js.map +1 -1
- package/dist/drop-terms.js +122 -0
- package/dist/drop-terms.js.map +7 -0
- package/dist/drop-terms.test.js +56 -0
- package/dist/drop-terms.test.js.map +7 -0
- package/dist/empty-fields.test.js +1 -1
- package/dist/empty-fields.test.js.map +1 -1
- package/dist/ending-punctuation.test.js +39 -19
- package/dist/ending-punctuation.test.js.map +2 -2
- package/dist/field-008-18-34-character-groups.test.js +2 -8
- package/dist/field-008-18-34-character-groups.test.js.map +2 -2
- package/dist/field-505-separators.test.js +1 -7
- package/dist/field-505-separators.test.js.map +2 -2
- package/dist/field-521-fix.test.js +1 -7
- package/dist/field-521-fix.test.js.map +2 -2
- package/dist/field-exclusion.test.js +11 -8
- package/dist/field-exclusion.test.js.map +2 -2
- package/dist/field-structure.test.js +1 -1
- package/dist/field-structure.test.js.map +1 -1
- package/dist/fields-present.test.js +1 -1
- package/dist/fields-present.test.js.map +1 -1
- package/dist/fix-33X.test.js +1 -1
- package/dist/fix-33X.test.js.map +1 -1
- package/dist/fix-country-codes.test.js +1 -7
- package/dist/fix-country-codes.test.js.map +2 -2
- package/dist/fix-sami-041.js +87 -0
- package/dist/fix-sami-041.js.map +7 -0
- package/dist/fix-sami-041.test.js +40 -0
- package/dist/fix-sami-041.test.js.map +7 -0
- package/dist/fixRelatorTerms.test.js +2 -8
- package/dist/fixRelatorTerms.test.js.map +2 -2
- package/dist/fixed-fields.test.js +29 -18
- package/dist/fixed-fields.test.js.map +2 -2
- package/dist/identical-fields.test.js +1 -1
- package/dist/identical-fields.test.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +2 -2
- package/dist/indicator-fixes.js +10 -0
- package/dist/indicator-fixes.js.map +2 -2
- package/dist/indicator-fixes.test.js +1 -7
- package/dist/indicator-fixes.test.js.map +2 -2
- package/dist/isbn-issn.js +1 -1
- package/dist/isbn-issn.js.map +2 -2
- package/dist/isbn-issn.test.js +9 -6
- package/dist/isbn-issn.test.js.map +2 -2
- package/dist/item-language.test.js +1 -1
- package/dist/item-language.test.js.map +2 -2
- package/dist/merge-fields.test.js +2 -7
- package/dist/merge-fields.test.js.map +2 -2
- package/dist/mergeField500Lisapainokset.test.js +1 -7
- package/dist/mergeField500Lisapainokset.test.js.map +2 -2
- package/dist/mergeRelatorTermFields.test.js +1 -7
- package/dist/mergeRelatorTermFields.test.js.map +2 -2
- package/dist/multiple-subfield-0.test.js +1 -7
- package/dist/multiple-subfield-0.test.js.map +2 -2
- package/dist/normalize-dashes.test.js +1 -7
- package/dist/normalize-dashes.test.js.map +2 -2
- package/dist/normalize-identifiers.test.js +1 -7
- package/dist/normalize-identifiers.test.js.map +2 -2
- package/dist/normalize-qualifying-information.test.js +1 -7
- package/dist/normalize-qualifying-information.test.js.map +2 -2
- package/dist/normalize-utf8-diacritics.test.js +1 -7
- package/dist/normalize-utf8-diacritics.test.js.map +2 -2
- package/dist/normalizeFieldForComparison.js +24 -0
- package/dist/normalizeFieldForComparison.js.map +2 -2
- package/dist/punctuation.test.js +1 -7
- package/dist/punctuation.test.js.map +2 -2
- package/dist/punctuation2.test.js +2 -8
- package/dist/punctuation2.test.js.map +2 -2
- package/dist/reindexSubfield6OccurenceNumbers.test.js +1 -7
- package/dist/reindexSubfield6OccurenceNumbers.test.js.map +2 -2
- package/dist/remove-041-zxx.js +56 -0
- package/dist/remove-041-zxx.js.map +7 -0
- package/dist/remove-041-zxx.test.js +40 -0
- package/dist/remove-041-zxx.test.js.map +7 -0
- package/dist/removeDuplicateDataFields.test.js +2 -8
- package/dist/removeDuplicateDataFields.test.js.map +2 -2
- package/dist/removeInferiorDataFields.js +1 -9
- package/dist/removeInferiorDataFields.js.map +2 -2
- package/dist/removeInferiorDataFields.test.js +1 -7
- package/dist/removeInferiorDataFields.test.js.map +2 -2
- package/dist/resolvable-ext-references-melinda.test.js +1 -1
- package/dist/resolvable-ext-references-melinda.test.js.map +2 -2
- package/dist/resolveOrphanedSubfield6s.js +1 -3
- package/dist/resolveOrphanedSubfield6s.js.map +2 -2
- package/dist/resolveOrphanedSubfield6s.test.js +1 -7
- package/dist/resolveOrphanedSubfield6s.test.js.map +2 -2
- package/dist/sanitize-vocabulary-source-codes.test.js +1 -7
- package/dist/sanitize-vocabulary-source-codes.test.js.map +2 -2
- package/dist/sort-tags.test.js +1 -1
- package/dist/sort-tags.test.js.map +1 -1
- package/dist/sortFields.js +16 -1
- package/dist/sortFields.js.map +2 -2
- package/dist/sortFields.test.js +1 -7
- package/dist/sortFields.test.js.map +2 -2
- package/dist/sortRelatorTerms.test.js +1 -7
- package/dist/sortRelatorTerms.test.js.map +2 -2
- package/dist/sortSubfields.js +3 -1
- package/dist/sortSubfields.js.map +2 -2
- package/dist/sortSubfields.test.js +1 -7
- package/dist/sortSubfields.test.js.map +2 -2
- package/dist/stripPunctuation.js +7 -4
- package/dist/stripPunctuation.js.map +2 -2
- package/dist/stripPunctuation.test.js +1 -7
- package/dist/stripPunctuation.test.js.map +2 -2
- package/dist/subfield-exclusion.test.js +1 -1
- package/dist/subfield-exclusion.test.js.map +1 -1
- package/dist/subfield6Utils.js +1 -13
- package/dist/subfield6Utils.js.map +2 -2
- package/dist/subfieldValueNormalizations.test.js +1 -7
- package/dist/subfieldValueNormalizations.test.js.map +2 -2
- package/dist/sync-007-and-300.test.js +1 -7
- package/dist/sync-007-and-300.test.js.map +2 -2
- package/dist/sync-language.js +103 -0
- package/dist/sync-language.js.map +7 -0
- package/dist/sync-language.test.js +40 -0
- package/dist/sync-language.test.js.map +7 -0
- package/dist/translate-terms.js +121 -85
- package/dist/translate-terms.js.map +3 -3
- package/dist/translate-terms.test.js +5 -8
- package/dist/translate-terms.test.js.map +2 -2
- package/dist/unicode-decomposition.test.js +1 -1
- package/dist/unicode-decomposition.test.js.map +1 -1
- package/dist/update-field-540.test.js +2 -8
- package/dist/update-field-540.test.js.map +2 -2
- package/dist/urn.test.js +2 -8
- package/dist/urn.test.js.map +2 -2
- package/package.json +18 -16
- package/src/access-rights.test.js +1 -1
- package/src/addMissingField337.test.js +1 -1
- package/src/addMissingField338.test.js +1 -1
- package/src/cyrillux-usemarcon-replacement.test.js +4 -9
- package/src/cyrillux.test.js +1 -1
- package/src/disambiguateSeriesStatements.test.js +3 -8
- package/src/double-commas.test.js +1 -1
- package/src/drop-terms.js +162 -0
- package/src/drop-terms.test.js +81 -0
- package/src/empty-fields.test.js +1 -1
- package/src/ending-punctuation.test.js +28 -20
- package/src/field-008-18-34-character-groups.test.js +4 -9
- package/src/field-505-separators.test.js +3 -8
- package/src/field-521-fix.test.js +3 -8
- package/src/field-exclusion.test.js +10 -8
- package/src/field-structure.test.js +1 -1
- package/src/fields-present.test.js +1 -1
- package/src/fix-33X.test.js +1 -1
- package/src/fix-country-codes.test.js +3 -8
- package/src/fix-sami-041.js +113 -0
- package/src/fix-sami-041.test.js +52 -0
- package/src/fixRelatorTerms.test.js +4 -9
- package/src/fixed-fields.test.js +24 -18
- package/src/identical-fields.test.js +1 -1
- package/src/index.js +8 -1
- package/src/indicator-fixes.js +12 -0
- package/src/indicator-fixes.test.js +3 -8
- package/src/isbn-issn.js +1 -1
- package/src/isbn-issn.test.js +8 -6
- package/src/item-language.test.js +2 -2
- package/src/merge-fields.test.js +3 -8
- package/src/mergeField500Lisapainokset.test.js +3 -8
- package/src/mergeRelatorTermFields.test.js +3 -8
- package/src/multiple-subfield-0.test.js +3 -8
- package/src/normalize-dashes.test.js +3 -8
- package/src/normalize-identifiers.test.js +3 -8
- package/src/normalize-qualifying-information.test.js +3 -8
- package/src/normalize-utf8-diacritics.test.js +3 -8
- package/src/normalizeFieldForComparison.js +26 -0
- package/src/punctuation.test.js +3 -8
- package/src/punctuation2.test.js +4 -9
- package/src/reindexSubfield6OccurenceNumbers.test.js +3 -8
- package/src/remove-041-zxx.js +85 -0
- package/src/remove-041-zxx.test.js +52 -0
- package/src/removeDuplicateDataFields.test.js +4 -9
- package/src/removeInferiorDataFields.js +7 -7
- package/src/removeInferiorDataFields.test.js +3 -8
- package/src/resolvable-ext-references-melinda.test.js +5 -5
- package/src/resolveOrphanedSubfield6s.js +3 -3
- package/src/resolveOrphanedSubfield6s.test.js +3 -8
- package/src/sanitize-vocabulary-source-codes.test.js +3 -8
- package/src/sort-tags.test.js +1 -1
- package/src/sortFields.js +20 -1
- package/src/sortFields.test.js +3 -8
- package/src/sortRelatorTerms.test.js +3 -8
- package/src/sortSubfields.js +3 -1
- package/src/sortSubfields.test.js +3 -8
- package/src/stripPunctuation.js +9 -6
- package/src/stripPunctuation.test.js +3 -8
- package/src/subfield-exclusion.test.js +1 -1
- package/src/subfield6Utils.js +13 -13
- package/src/subfieldValueNormalizations.test.js +3 -8
- package/src/sync-007-and-300.test.js +3 -8
- package/src/sync-language.js +148 -0
- package/src/sync-language.test.js +52 -0
- package/src/translate-terms.js +158 -103
- package/src/translate-terms.test.js +12 -16
- package/src/unicode-decomposition.test.js +1 -1
- package/src/update-field-540.test.js +4 -9
- package/src/urn.test.js +4 -9
- package/test-fixtures/drop-terms/01/expectedResult.json +31 -0
- package/test-fixtures/drop-terms/01/metadata.json +6 -0
- package/test-fixtures/drop-terms/01/record.json +35 -0
- package/test-fixtures/drop-terms/02/expectedResult.json +7 -0
- package/test-fixtures/drop-terms/02/metadata.json +6 -0
- package/test-fixtures/drop-terms/02/record.json +40 -0
- package/test-fixtures/drop-terms/03/expectedResult.json +6 -0
- package/test-fixtures/drop-terms/03/metadata.json +18 -0
- package/test-fixtures/drop-terms/03/record.json +39 -0
- package/test-fixtures/drop-terms/04/expectedResult.json +6 -0
- package/test-fixtures/drop-terms/04/metadata.json +19 -0
- package/test-fixtures/drop-terms/04/record.json +24 -0
- package/test-fixtures/fix-language-codes/02/metadata.json +1 -1
- package/test-fixtures/fix-sami-041/01/expectedResult.json +6 -0
- package/test-fixtures/fix-sami-041/01/metadata.json +4 -0
- package/test-fixtures/fix-sami-041/01/record.json +13 -0
- package/test-fixtures/fix-sami-041/02/expectedResult.json +10 -0
- package/test-fixtures/fix-sami-041/02/metadata.json +4 -0
- package/test-fixtures/fix-sami-041/02/record.json +8 -0
- package/test-fixtures/fix-sami-041/03/expectedResult.json +5 -0
- package/test-fixtures/fix-sami-041/03/metadata.json +5 -0
- package/test-fixtures/fix-sami-041/03/record.json +8 -0
- package/test-fixtures/fix-sami-041/04/expectedResult.json +7 -0
- package/test-fixtures/fix-sami-041/04/metadata.json +4 -0
- package/test-fixtures/fix-sami-041/04/record.json +10 -0
- package/test-fixtures/fix-sami-041/05/expectedResult.json +10 -0
- package/test-fixtures/fix-sami-041/05/metadata.json +6 -0
- package/test-fixtures/fix-sami-041/05/record.json +8 -0
- package/test-fixtures/indicator-fixes/11/expectedResult.json +10 -0
- package/test-fixtures/indicator-fixes/11/metadata.json +4 -0
- package/test-fixtures/indicator-fixes/11/record.json +10 -0
- package/test-fixtures/merge-fields/f05/metadata.json +1 -1
- package/test-fixtures/remove-041-zxx/01/expectedResult.json +5 -0
- package/test-fixtures/remove-041-zxx/01/metadata.json +5 -0
- package/test-fixtures/remove-041-zxx/01/record.json +10 -0
- package/test-fixtures/remove-041-zxx/02/expectedResult.json +7 -0
- package/test-fixtures/remove-041-zxx/02/metadata.json +5 -0
- package/test-fixtures/remove-041-zxx/02/record.json +9 -0
- package/test-fixtures/remove-041-zxx/11/expectedResult.json +10 -0
- package/test-fixtures/remove-041-zxx/11/metadata.json +5 -0
- package/test-fixtures/remove-041-zxx/11/record.json +9 -0
- package/test-fixtures/remove-041-zxx/12/expectedResult.json +10 -0
- package/test-fixtures/remove-041-zxx/12/metadata.json +5 -0
- package/test-fixtures/remove-041-zxx/12/record.json +9 -0
- package/test-fixtures/sort-fields/15/input.json +9 -0
- package/test-fixtures/sort-fields/15/metadata.json +5 -0
- package/test-fixtures/sort-fields/15/result.json +10 -0
- package/test-fixtures/sync-language/01/expectedResult.json +5 -0
- package/test-fixtures/sync-language/01/metadata.json +5 -0
- package/test-fixtures/sync-language/01/record.json +7 -0
- package/test-fixtures/sync-language/02/expectedResult.json +6 -0
- package/test-fixtures/sync-language/02/metadata.json +5 -0
- package/test-fixtures/sync-language/02/record.json +10 -0
- package/test-fixtures/sync-language/03/expectedResult.json +6 -0
- package/test-fixtures/sync-language/03/metadata.json +5 -0
- package/test-fixtures/sync-language/03/record.json +6 -0
- package/test-fixtures/sync-language/10/expectedResult.json +10 -0
- package/test-fixtures/sync-language/10/metadata.json +5 -0
- package/test-fixtures/sync-language/10/record.json +8 -0
- package/test-fixtures/sync-language/11/expectedResult.json +10 -0
- package/test-fixtures/sync-language/11/metadata.json +5 -0
- package/test-fixtures/sync-language/11/record.json +7 -0
- package/test-fixtures/sync-language/12/expectedResult.json +9 -0
- package/test-fixtures/sync-language/12/metadata.json +6 -0
- package/test-fixtures/sync-language/12/record.json +6 -0
- package/test-fixtures/sync-language/13/expectedResult.json +10 -0
- package/test-fixtures/sync-language/13/metadata.json +5 -0
- package/test-fixtures/sync-language/13/record.json +8 -0
- package/test-fixtures/sync-language/14/expectedResult.json +9 -0
- package/test-fixtures/sync-language/14/metadata.json +5 -0
- package/test-fixtures/sync-language/14/record.json +7 -0
- package/test-fixtures/sync-language/15/expectedResult.json +9 -0
- package/test-fixtures/sync-language/15/metadata.json +5 -0
- package/test-fixtures/sync-language/15/record.json +7 -0
- package/test-fixtures/translate-terms/05/expectedResult.json +12 -0
- package/test-fixtures/translate-terms/05/metadata.json +7 -0
- package/test-fixtures/translate-terms/05/record.json +11 -0
- package/test-fixtures/translate-terms/06/expectedResult.json +12 -0
- package/test-fixtures/translate-terms/06/metadata.json +7 -0
- package/test-fixtures/translate-terms/06/record.json +11 -0
- package/test-fixtures/translate-terms-data.js +23 -0
package/src/fix-33X.test.js
CHANGED
|
@@ -22,7 +22,7 @@ generateTests({
|
|
|
22
22
|
async function testValidatorFactory() {
|
|
23
23
|
const validator = await validatorFactory();
|
|
24
24
|
|
|
25
|
-
assert.equal(typeof validator, '
|
|
25
|
+
assert.equal(typeof validator, 'object');
|
|
26
26
|
assert.equal(typeof validator.description, 'string');
|
|
27
27
|
assert.equal(typeof validator.validate, 'function');
|
|
28
28
|
assert.equal(typeof validator.fix, 'function');
|
|
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
|
|
|
3
3
|
import validatorFactory from './fix-country-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/fix-country-codes:test');
|
|
22
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/fix-country-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,
|
|
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,113 @@
|
|
|
1
|
+
// Author(s): Nicholas Volk
|
|
2
|
+
|
|
3
|
+
//import createDebugLogger from 'debug';
|
|
4
|
+
import clone from 'clone';
|
|
5
|
+
|
|
6
|
+
import {fieldToString} from './utils.js';
|
|
7
|
+
|
|
8
|
+
// const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:fix-sami-041');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default function () {
|
|
13
|
+
/* 'sma': eteläsaame, 'sme': pohjoissaame, 'smj': luulajansaame, 'smn': inarinsaame, 'sms': koltansaame */
|
|
14
|
+
const samiLanguages = ['sma', 'sme', 'smj', 'smn', 'sms'];
|
|
15
|
+
const relevantSubfieldCodes = ['a', 'd']; // Subfield codes that should also have 'smi' if a sami langauge is used. Confirmed by A.R. via Slack 2025-12-05
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
description: 'Add corresponing \'smi\' subfield before a specific sami language subfields, if needed',
|
|
19
|
+
validate, fix
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function fix(record, validateMode = false) {
|
|
23
|
+
const relevantFields = record.fields.filter(f => isRelevantField(f, validateMode)).map(f => validateMode ? clone(f) : f); // NV! relevant fields are cloned in validation mode!
|
|
24
|
+
// Nothing to do:
|
|
25
|
+
if (relevantFields.length === 0) {
|
|
26
|
+
if (validateMode) {
|
|
27
|
+
return {message: [], valid: true};
|
|
28
|
+
}
|
|
29
|
+
return {message: [], fix: [], valid: true};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const relevantFieldsAsStrings = relevantFields.map(f => fieldToString(f)); // get original values
|
|
33
|
+
|
|
34
|
+
relevantFields.forEach(f => processField(f));
|
|
35
|
+
const modFieldsAsStrings = relevantFields.map(f => fieldToString(f));
|
|
36
|
+
const report = [...updateAndReport008(), ...createReport(relevantFieldsAsStrings, modFieldsAsStrings)];
|
|
37
|
+
|
|
38
|
+
if (validateMode) {
|
|
39
|
+
return {'message': report, 'valid': false};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {message: [], fix: report, valid: true};
|
|
43
|
+
|
|
44
|
+
function updateAndReport008() {
|
|
45
|
+
const [f008] = record.get('008').map(f => validateMode ? clone(f) : f);
|
|
46
|
+
|
|
47
|
+
if (!f008) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
const currLang = f008.value.substr(35, 3);
|
|
51
|
+
if (!samiLanguages.includes(currLang)) { // NB! If original 008/35-37 was not a sami language, we don't change anything!
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const origValue = f008.value;
|
|
55
|
+
const firstRelevantSubfield = relevantFields[0].subfields.find(sf => sf.code === 'a' || sf.code === 'd'); // NB! don't use relevantSubfieldCodes here!
|
|
56
|
+
if (firstRelevantSubfield.value === 'smi') { // First relevant subfield is
|
|
57
|
+
f008.value = `${f008.value.substr(0, 35)}smi${f008.value.substr(38)}`;
|
|
58
|
+
}
|
|
59
|
+
return createReport([origValue], [f008.value]);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function createReport(origArray, modArray) {
|
|
64
|
+
return origArray.map((entry, index) => createEntry(entry, index));
|
|
65
|
+
|
|
66
|
+
function createEntry(item, index) {
|
|
67
|
+
return `'${item}' => '${modArray[index]}'`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function validate(record) {
|
|
72
|
+
return fix(record, true);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function processField(f) {
|
|
76
|
+
f.subfields = prosessSubfields(f.subfields);
|
|
77
|
+
return f;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function prosessSubfields(incomingSubfields, outgoingSubfields = []) {
|
|
81
|
+
const [currSubfield, ...otherSubfields] = incomingSubfields;
|
|
82
|
+
if (!currSubfield) {
|
|
83
|
+
return outgoingSubfields;
|
|
84
|
+
}
|
|
85
|
+
if (!isRelevantSamiSubfield(currSubfield, [...outgoingSubfields, ...otherSubfields])) {
|
|
86
|
+
return prosessSubfields(otherSubfields, [...outgoingSubfields, currSubfield]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const smiSubfield = {
|
|
90
|
+
code: currSubfield.code,
|
|
91
|
+
value: 'smi'
|
|
92
|
+
};
|
|
93
|
+
return prosessSubfields(otherSubfields, [...outgoingSubfields, smiSubfield, currSubfield]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isRelevantField(f) {
|
|
97
|
+
if (f.tag !== '041' || !f.subfields || f.subfields.some(sf => sf.code === '2')) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return f.subfields.some(sf => isRelevantSamiSubfield(sf, f.subfields)); // it's ok to pass sf in f.subfields also
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isRelevantSamiSubfield(sf, otherSubfields) {
|
|
104
|
+
if (!relevantSubfieldCodes.includes(sf.code) || !samiLanguages.includes(sf.value)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
if (otherSubfields.some(sf2 => sf2.code === sf.code && sf2.value === 'smi')) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
//import createDebugLogger from 'debug';
|
|
3
|
+
|
|
4
|
+
import validatorFactory from './fix-sami-041.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', 'fix-sami-041'],
|
|
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); // The record should now change in validation-only
|
|
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 '
|
|
3
|
+
import validatorFactory from './fixRelatorTerms.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/fixRelatorTerms:test');
|
|
23
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/fixRelatorTerms: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,
|
|
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');
|
package/src/fixed-fields.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
3
|
-
import validatorFactory from '
|
|
3
|
+
import validatorFactory from './fixed-fields.js';
|
|
4
4
|
import {describe, it} from 'node:test';
|
|
5
5
|
|
|
6
6
|
|
|
@@ -27,11 +27,13 @@ describe('fixed-fields: language', () => {
|
|
|
27
27
|
const validator = await validatorFactory([
|
|
28
28
|
{leader: true, length: 6, rules: [{position: [0, 6], pattern: /[abcdefg]/u}]},
|
|
29
29
|
{tag: /^FOO$/u, length: 12, rules: [{position: 0, pattern: /f/u}]},
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
{
|
|
31
|
+
tag: /^BAR$/u, length: 6, rules: [
|
|
32
|
+
{position: 0, pattern: /[fb]/u},
|
|
33
|
+
{position: 1, pattern: /a/u, dependencies: [{position: 0, pattern: /b/u}]},
|
|
34
|
+
{position: [2, 3], pattern: /u/u, dependencies: [{position: 0, pattern: /[^b]/u}]}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
35
37
|
]);
|
|
36
38
|
const record = new MarcRecord({
|
|
37
39
|
leader: 'bacgfe',
|
|
@@ -56,11 +58,13 @@ describe('fixed-fields: language', () => {
|
|
|
56
58
|
const validator = await validatorFactory([
|
|
57
59
|
{leader: true, length: 6, rules: [{position: [0, 6], pattern: /[abcdefg]/u}]},
|
|
58
60
|
{tag: /^FOO$/u, length: 12, rules: [{position: 0, pattern: /f/u}]},
|
|
59
|
-
{
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
{
|
|
62
|
+
tag: /^BAR$/u, length: 6, rules: [
|
|
63
|
+
{position: 0, pattern: /[fb]/u},
|
|
64
|
+
{position: 1, pattern: /a/u, dependencies: [{position: 0, pattern: /b/u}]},
|
|
65
|
+
{position: [2, 3], pattern: /u/u, dependencies: [{position: 0, pattern: /[^a]/u}]}
|
|
66
|
+
]
|
|
67
|
+
},
|
|
64
68
|
{tag: /^FUB$/u, length: 5}
|
|
65
69
|
]);
|
|
66
70
|
const record = new MarcRecord({
|
|
@@ -83,13 +87,15 @@ describe('fixed-fields: language', () => {
|
|
|
83
87
|
|
|
84
88
|
const result = await validator.validate(record);
|
|
85
89
|
|
|
86
|
-
assert.deepEqual(result, {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
assert.deepEqual(result, {
|
|
91
|
+
valid: false, messages: [
|
|
92
|
+
'Leader has invalid values at positions: 3 (Rule index 0)',
|
|
93
|
+
'Field FOO has invalid values at positions: 0 (Rule index 0)',
|
|
94
|
+
'Field BAR has invalid values at positions: 1 (Rule index 1)',
|
|
95
|
+
'Field BAR has invalid values at positions: 2,3 (Rule index 2)',
|
|
96
|
+
'Field FUB has invalid length'
|
|
97
|
+
]
|
|
98
|
+
});
|
|
93
99
|
});
|
|
94
100
|
});
|
|
95
101
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
3
|
-
import validatorFactory from '
|
|
3
|
+
import validatorFactory from './identical-fields.js';
|
|
4
4
|
import {describe, it} from 'node:test';
|
|
5
5
|
|
|
6
6
|
describe('identical-fields', () => {
|
package/src/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import Fix33X from './fix-33X.js';
|
|
|
21
21
|
import FixCountryCodes from './fix-country-codes.js';
|
|
22
22
|
import FixLanguageCodes from './fix-language-codes.js';
|
|
23
23
|
import FixRelatorTerms from './fixRelatorTerms.js';
|
|
24
|
+
import FixSami041 from './fix-sami-041.js';
|
|
24
25
|
import FixedFields from './fixed-fields.js';
|
|
25
26
|
import IdenticalFields from './identical-fields.js';
|
|
26
27
|
import IndicatorFixes from './indicator-fixes.js';
|
|
@@ -39,6 +40,7 @@ import NormalizeUTF8Diacritics from './normalize-utf8-diacritics.js';
|
|
|
39
40
|
import Punctuation from './punctuation/index.js';
|
|
40
41
|
import Punctuation2 from './punctuation2.js';
|
|
41
42
|
import ReindexSubfield6OccurenceNumbers from './reindexSubfield6OccurenceNumbers.js';
|
|
43
|
+
import Remove041zxx from './remove-041-zxx.js';
|
|
42
44
|
import RemoveDuplicateDataFields from './removeDuplicateDataFields.js';
|
|
43
45
|
import RemoveInferiorDataFields from './removeInferiorDataFields.js';
|
|
44
46
|
import ResolvableExtReferences from './resolvable-ext-references-melinda.js';
|
|
@@ -52,6 +54,7 @@ import SortTags from './sort-tags.js';
|
|
|
52
54
|
import SubfieldValueNormalizations from './subfieldValueNormalizations.js';
|
|
53
55
|
import SubfieldExclusion from './subfield-exclusion.js';
|
|
54
56
|
import Sync007And300 from './sync-007-and-300.js';
|
|
57
|
+
import SyncLanguage from './sync-language.js';
|
|
55
58
|
import TranslateTerms from './translate-terms.js';
|
|
56
59
|
import TypeOfDateF008 from './typeOfDate-008.js';
|
|
57
60
|
import UnicodeDecomposition from './unicode-decomposition.js';
|
|
@@ -105,11 +108,13 @@ export {
|
|
|
105
108
|
FixCountryCodes,
|
|
106
109
|
FixLanguageCodes,
|
|
107
110
|
FixRelatorTerms,
|
|
111
|
+
FixSami041,
|
|
108
112
|
FixedFields,
|
|
109
113
|
IdenticalFields,
|
|
110
114
|
IndicatorFixes,
|
|
111
115
|
IsbnIssn,
|
|
112
116
|
ItemLanguage,
|
|
117
|
+
|
|
113
118
|
MergeField500Lisapainokset,
|
|
114
119
|
MergeRelatorTermFields,
|
|
115
120
|
Modernize502, //
|
|
@@ -123,6 +128,7 @@ export {
|
|
|
123
128
|
Punctuation2,
|
|
124
129
|
ResolveOrphanedSubfield6s, // Do this before reindexing! (thus I'm not sticking with alphabetical order here)
|
|
125
130
|
ReindexSubfield6OccurenceNumbers,
|
|
131
|
+
Remove041zxx,
|
|
126
132
|
RemoveDuplicateDataFields,
|
|
127
133
|
RemoveInferiorDataFields,
|
|
128
134
|
ResolvableExtReferences,
|
|
@@ -133,8 +139,9 @@ export {
|
|
|
133
139
|
SubfieldExclusion,
|
|
134
140
|
SubfieldValueNormalizations,
|
|
135
141
|
Sync007And300,
|
|
136
|
-
|
|
142
|
+
SyncLanguage,
|
|
137
143
|
TranslateTerms,
|
|
144
|
+
TypeOfDateF008,
|
|
138
145
|
UnicodeDecomposition,
|
|
139
146
|
UpdateField540,
|
|
140
147
|
Urn,
|
package/src/indicator-fixes.js
CHANGED
|
@@ -241,6 +241,17 @@ function getLanguages(record) {
|
|
|
241
241
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
function translated041Indicator1(field){
|
|
245
|
+
if (field.tag !== '041' || !field.subfields) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (field.ind1 !== '1' && field.subfields.some(sf => ['h', 'k', 'm', 'n'].includes(sf.code))) {
|
|
249
|
+
field.ind1 = '1';
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
}
|
|
254
|
+
|
|
244
255
|
function recordNormalizeIndicators(record) {
|
|
245
256
|
recordNormalize490(record);
|
|
246
257
|
|
|
@@ -252,6 +263,7 @@ function recordNormalizeIndicators(record) {
|
|
|
252
263
|
}
|
|
253
264
|
|
|
254
265
|
function fieldNormalizeIndicators(field, record, languages) {
|
|
266
|
+
translated041Indicator1(field);
|
|
255
267
|
normalize084Indicator1(field);
|
|
256
268
|
normalize245Indicator1(field, record);
|
|
257
269
|
noDisplayConstantGenerated520Indicator1(field);
|
|
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
|
|
|
3
3
|
import validatorFactory from './indicator-fixes.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,
|
|
@@ -17,7 +17,7 @@ generateTests({
|
|
|
17
17
|
before: () => testValidatorFactory()
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/indicator-fixes:test');
|
|
20
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/indicator-fixes:test');
|
|
21
21
|
|
|
22
22
|
async function testValidatorFactory() {
|
|
23
23
|
const validator = await validatorFactory();
|
|
@@ -27,12 +27,7 @@ async function testValidatorFactory() {
|
|
|
27
27
|
assert.equal(typeof validator.validate, 'function');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async function callback({getFixture,
|
|
31
|
-
if (enabled === false) {
|
|
32
|
-
debug('TEST SKIPPED!');
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
30
|
+
async function callback({getFixture, fix = false}) {
|
|
36
31
|
const validator = await validatorFactory();
|
|
37
32
|
const record = new MarcRecord(getFixture('record.json'));
|
|
38
33
|
const expectedResult = getFixture('expectedResult.json');
|
package/src/isbn-issn.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ISBN from 'isbn3';
|
|
2
|
-
import validateISSN from '@natlibfi/issn-verify';
|
|
2
|
+
import {issn as validateISSN} from '@natlibfi/issn-verify';
|
|
3
3
|
|
|
4
4
|
// handleInvalid: move invalid 020$a to 020$z, and invalid 022$a to 022$y
|
|
5
5
|
export default ({hyphenateISBN = false, handleInvalid = false} = {}) => {
|
package/src/isbn-issn.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
3
|
-
import validatorFactory from '
|
|
3
|
+
import validatorFactory from './isbn-issn.js';
|
|
4
4
|
import {describe, it} from 'node:test';
|
|
5
5
|
|
|
6
6
|
describe('isbn-issn', () => {
|
|
@@ -186,11 +186,13 @@ describe('isbn-issn', () => {
|
|
|
186
186
|
});
|
|
187
187
|
const result = await validator.validate(record);
|
|
188
188
|
|
|
189
|
-
assert.deepEqual(result, {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
assert.deepEqual(result, {
|
|
190
|
+
valid: false, messages: [
|
|
191
|
+
'ISBN (9789519155470) is not valid',
|
|
192
|
+
'ISBN (9068-31-372-X) is not valid',
|
|
193
|
+
'ISBN (386006004X) is not valid'
|
|
194
|
+
]
|
|
195
|
+
});
|
|
194
196
|
});
|
|
195
197
|
|
|
196
198
|
it.skip('Finds the record invalid (Missing ISBN)');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import {MarcRecord} from '@natlibfi/marc-record';
|
|
3
|
-
import validatorFactory from '
|
|
3
|
+
import validatorFactory from './item-language.js';
|
|
4
4
|
import {describe, it} from 'node:test';
|
|
5
5
|
|
|
6
6
|
describe('item-language', () => {
|
|
@@ -17,7 +17,7 @@ describe('item-language', () => {
|
|
|
17
17
|
assert.equal(err instanceof Error, true);
|
|
18
18
|
assert.equal(err.message, 'No tagPattern provided');
|
|
19
19
|
return true;
|
|
20
|
-
|
|
20
|
+
});
|
|
21
21
|
//await assert(validatorFactory()).to.be.rejectedWith(Error, 'No tagPattern provided');
|
|
22
22
|
});
|
|
23
23
|
|
package/src/merge-fields.test.js
CHANGED
|
@@ -4,7 +4,7 @@ import validatorFactory from './merge-fields/index.js';
|
|
|
4
4
|
import {READERS} from '@natlibfi/fixura';
|
|
5
5
|
import generateTests from '@natlibfi/fixugen';
|
|
6
6
|
import createDebugLogger from 'debug';
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
|
|
9
9
|
generateTests({
|
|
10
10
|
callback,
|
|
@@ -30,13 +30,8 @@ async function testValidatorFactory() {
|
|
|
30
30
|
assert.equal(typeof validator.validate, 'function');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
async function callback({getFixture,
|
|
34
|
-
|
|
35
|
-
debug('TEST SKIPPED!');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
nvdebug(`TAG PATTERN: ${tagPattern}`);
|
|
33
|
+
async function callback({getFixture, fix = false, tagPattern = false}) {
|
|
34
|
+
debug(`Run test using tag pattern ${tagPattern}`);
|
|
40
35
|
|
|
41
36
|
const validator = await validatorFactory(tagPattern);
|
|
42
37
|
const record = new MarcRecord(getFixture('record.json'));
|
|
@@ -3,7 +3,7 @@ import {MarcRecord} from '@natlibfi/marc-record';
|
|
|
3
3
|
import validatorFactory from './mergeField500Lisapainokset.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/mergeField500Lisapainokset:test');
|
|
22
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/mergeField500Lisapainokset: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,
|
|
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 './mergeRelatorTermFields.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/mergeRelatorTermFields:test');
|
|
22
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/mergeRelatorTermFields: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,
|
|
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 './multiple-subfield-0.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/multiple-subfield-0:test');
|
|
23
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/multiple-subfield-0: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,
|
|
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 './normalize-dashes.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-dashes:test');
|
|
22
|
+
//const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/normalize-dashes: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,
|
|
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');
|