@natlibfi/marc-record-validators-melinda 10.0.1-alpha.1 → 10.0.1-alpha.2
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/ending-whitespace.js +3 -0
- package/dist/ending-whitespace.js.map +1 -1
- package/dist/ending-whitespace.spec.js +0 -7
- package/dist/ending-whitespace.spec.js.map +1 -1
- package/dist/non-breaking-space.spec.js +0 -7
- package/dist/non-breaking-space.spec.js.map +1 -1
- package/package.json +1 -1
- package/src/ending-whitespace.js +4 -0
- package/src/ending-whitespace.spec.js +1 -8
- package/src/non-breaking-space.spec.js +1 -8
- package/test-fixtures/ending-whitespace/01/metadata.json +2 -1
- package/test-fixtures/ending-whitespace/02/metadata.json +2 -1
- package/test-fixtures/ending-whitespace/03/metadata.json +2 -1
- package/test-fixtures/non-breaking-space/01/metadata.json +2 -1
- package/test-fixtures/non-breaking-space/02/metadata.json +2 -1
- package/test-fixtures/non-breaking-space/03/metadata.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ending-whitespace.js","names":["description","validate","fix","record","nonValidFields","fields","filter","subfields","valueEndsWithWhitespace","length","valid","messages","flatMap","tag","map","sf","code","forEach","subfield","value","trimEnd","test"],"sources":["../src/ending-whitespace.js"],"sourcesContent":["/**\n * Provides interface to validate and fix record fields, which include subfields that end with whitespace character\n * @returns {Object} Object containing interfaces required by marc-record-validators-melinda package\n */\nexport default function () {\n return {\n description: 'Handles subfields that ends with whitespace character',\n validate,\n fix\n };\n\n function validate(record) {\n const nonValidFields = record.fields.filter(({subfields}) => subfields.filter(valueEndsWithWhitespace).length > 0);\n\n const valid = nonValidFields.length === 0;\n const messages = nonValidFields.flatMap(({tag, subfields}) => subfields.map(sf => `Field ${tag} subfield $${sf.code} ends with whitespace`));\n\n return valid ? {valid, messages: []} : {valid, messages};\n }\n\n /* eslint-disable functional/immutable-data,functional/no-conditional-statement */\n function fix(record) {\n record.fields.forEach(({subfields}) => {\n subfields.forEach(subfield => {\n if (valueEndsWithWhitespace(subfield)) {\n subfield.value = subfield.value.trimEnd();\n }\n });\n });\n }\n /* eslint-enable functional/immutable-data,functional/no-conditional-statement */\n\n function valueEndsWithWhitespace({value}) {\n return (/\\s$/u).test(value);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACe,oBAAY;EACzB,OAAO;IACLA,WAAW,EAAE,uDAAuD;IACpEC,QAAQ;IACRC;EACF,CAAC;EAED,SAASD,QAAQ,CAACE,MAAM,EAAE;IACxB,MAAMC,cAAc,GAAGD,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC,CAAC;MAACC;IAAS,CAAC,KAAKA,SAAS,CAACD,MAAM,CAACE,uBAAuB,CAAC,CAACC,MAAM,GAAG,CAAC,CAAC;IAElH,MAAMC,KAAK,GAAGN,cAAc,CAACK,MAAM,KAAK,CAAC;IACzC,MAAME,QAAQ,GAAGP,cAAc,CAACQ,OAAO,CAAC,CAAC;MAACC,GAAG;MAAEN;IAAS,CAAC,KAAKA,SAAS,CAACO,GAAG,CAACC,EAAE,IAAK,SAAQF,GAAI,cAAaE,EAAE,CAACC,IAAK,uBAAsB,CAAC,CAAC;IAE5I,OAAON,KAAK,GAAG;MAACA,KAAK;MAAEC,QAAQ,EAAE;IAAE,CAAC,GAAG;MAACD,KAAK;MAAEC;IAAQ,CAAC;EAC1D;;EAEA;EACA,SAAST,GAAG,CAACC,MAAM,EAAE;IACnBA,MAAM,CAACE,MAAM,CAACY,OAAO,CAAC,CAAC;MAACV;IAAS,CAAC,KAAK;
|
|
1
|
+
{"version":3,"file":"ending-whitespace.js","names":["description","validate","fix","record","nonValidFields","fields","filter","subfields","valueEndsWithWhitespace","length","valid","messages","flatMap","tag","map","sf","code","forEach","undefined","subfield","value","trimEnd","test"],"sources":["../src/ending-whitespace.js"],"sourcesContent":["/**\n * Provides interface to validate and fix record fields, which include subfields that end with whitespace character\n * @returns {Object} Object containing interfaces required by marc-record-validators-melinda package\n */\nexport default function () {\n return {\n description: 'Handles subfields that ends with whitespace character',\n validate,\n fix\n };\n\n function validate(record) {\n const nonValidFields = record.fields.filter(({subfields}) => subfields.filter(valueEndsWithWhitespace).length > 0);\n\n const valid = nonValidFields.length === 0;\n const messages = nonValidFields.flatMap(({tag, subfields}) => subfields.map(sf => `Field ${tag} subfield $${sf.code} ends with whitespace`));\n\n return valid ? {valid, messages: []} : {valid, messages};\n }\n\n /* eslint-disable functional/immutable-data,functional/no-conditional-statement */\n function fix(record) {\n record.fields.forEach(({subfields}) => {\n if (subfields === undefined) {\n return;\n }\n\n subfields.forEach(subfield => {\n if (valueEndsWithWhitespace(subfield)) {\n subfield.value = subfield.value.trimEnd();\n }\n });\n });\n }\n /* eslint-enable functional/immutable-data,functional/no-conditional-statement */\n\n function valueEndsWithWhitespace({value}) {\n return (/\\s$/u).test(value);\n }\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACe,oBAAY;EACzB,OAAO;IACLA,WAAW,EAAE,uDAAuD;IACpEC,QAAQ;IACRC;EACF,CAAC;EAED,SAASD,QAAQ,CAACE,MAAM,EAAE;IACxB,MAAMC,cAAc,GAAGD,MAAM,CAACE,MAAM,CAACC,MAAM,CAAC,CAAC;MAACC;IAAS,CAAC,KAAKA,SAAS,CAACD,MAAM,CAACE,uBAAuB,CAAC,CAACC,MAAM,GAAG,CAAC,CAAC;IAElH,MAAMC,KAAK,GAAGN,cAAc,CAACK,MAAM,KAAK,CAAC;IACzC,MAAME,QAAQ,GAAGP,cAAc,CAACQ,OAAO,CAAC,CAAC;MAACC,GAAG;MAAEN;IAAS,CAAC,KAAKA,SAAS,CAACO,GAAG,CAACC,EAAE,IAAK,SAAQF,GAAI,cAAaE,EAAE,CAACC,IAAK,uBAAsB,CAAC,CAAC;IAE5I,OAAON,KAAK,GAAG;MAACA,KAAK;MAAEC,QAAQ,EAAE;IAAE,CAAC,GAAG;MAACD,KAAK;MAAEC;IAAQ,CAAC;EAC1D;;EAEA;EACA,SAAST,GAAG,CAACC,MAAM,EAAE;IACnBA,MAAM,CAACE,MAAM,CAACY,OAAO,CAAC,CAAC;MAACV;IAAS,CAAC,KAAK;MACrC,IAAIA,SAAS,KAAKW,SAAS,EAAE;QAC3B;MACF;MAEAX,SAAS,CAACU,OAAO,CAACE,QAAQ,IAAI;QAC5B,IAAIX,uBAAuB,CAACW,QAAQ,CAAC,EAAE;UACrCA,QAAQ,CAACC,KAAK,GAAGD,QAAQ,CAACC,KAAK,CAACC,OAAO,EAAE;QAC3C;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EACA;;EAEA,SAASb,uBAAuB,CAAC;IAACY;EAAK,CAAC,EAAE;IACxC,OAAQ,MAAM,CAAEE,IAAI,CAACF,KAAK,CAAC;EAC7B;AACF"}
|
|
@@ -5,7 +5,6 @@ var _marcRecord = require("@natlibfi/marc-record");
|
|
|
5
5
|
var _endingWhitespace = _interopRequireDefault(require("./ending-whitespace"));
|
|
6
6
|
var _fixura = require("@natlibfi/fixura");
|
|
7
7
|
var _fixugen = _interopRequireDefault(require("@natlibfi/fixugen"));
|
|
8
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
9
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
9
|
(0, _fixugen.default)({
|
|
11
10
|
callback,
|
|
@@ -19,7 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
18
|
before: () => testValidatorFactory()
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
|
-
const debug = (0, _debug.default)('@natlibfi/marc-record-validators-melinda/ending-whitespace:test');
|
|
23
21
|
async function testValidatorFactory() {
|
|
24
22
|
const validator = await (0, _endingWhitespace.default)();
|
|
25
23
|
(0, _chai.expect)(validator).to.be.an('object').that.has.any.keys('description', 'validate');
|
|
@@ -28,13 +26,8 @@ async function testValidatorFactory() {
|
|
|
28
26
|
}
|
|
29
27
|
async function callback({
|
|
30
28
|
getFixture,
|
|
31
|
-
enabled = true,
|
|
32
29
|
fix = false
|
|
33
30
|
}) {
|
|
34
|
-
if (enabled === false) {
|
|
35
|
-
debug('TEST SKIPPED!');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
31
|
const validator = await (0, _endingWhitespace.default)();
|
|
39
32
|
const record = new _marcRecord.MarcRecord(getFixture('record.json'));
|
|
40
33
|
const expectedResult = getFixture('expectedResult.json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ending-whitespace.spec.js","names":["generateTests","callback","path","__dirname","useMetadataFile","recurse","fixura","reader","READERS","JSON","mocha","before","testValidatorFactory","
|
|
1
|
+
{"version":3,"file":"ending-whitespace.spec.js","names":["generateTests","callback","path","__dirname","useMetadataFile","recurse","fixura","reader","READERS","JSON","mocha","before","testValidatorFactory","validator","validatorFactory","expect","to","be","an","that","has","any","keys","description","a","validate","getFixture","fix","record","MarcRecord","expectedResult","result","eql"],"sources":["../src/ending-whitespace.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from './ending-whitespace';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen';\n\ngenerateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'ending-whitespace'],\n useMetadataFile: true,\n recurse: false,\n fixura: {\n reader: READERS.JSON\n },\n mocha: {\n before: () => testValidatorFactory()\n }\n});\n\nasync function testValidatorFactory() {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n}\n\nasync function callback({getFixture, fix = false}) {\n const validator = await validatorFactory();\n const record = new MarcRecord(getFixture('record.json'));\n const expectedResult = getFixture('expectedResult.json');\n\n if (!fix) {\n const result = await validator.validate(record);\n expect(result).to.eql(expectedResult);\n return;\n }\n\n await validator.fix(record);\n expect(record).to.eql(expectedResult);\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAA8C;AAE9C,IAAAA,gBAAa,EAAC;EACZC,QAAQ;EACRC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,mBAAmB,CAAC;EAC7DC,eAAe,EAAE,IAAI;EACrBC,OAAO,EAAE,KAAK;EACdC,MAAM,EAAE;IACNC,MAAM,EAAEC,eAAO,CAACC;EAClB,CAAC;EACDC,KAAK,EAAE;IACLC,MAAM,EAAE,MAAMC,oBAAoB;EACpC;AACF,CAAC,CAAC;AAEF,eAAeA,oBAAoB,GAAG;EACpC,MAAMC,SAAS,GAAG,MAAM,IAAAC,yBAAgB,GAAE;EAE1C,IAAAC,YAAM,EAACF,SAAS,CAAC,CACdG,EAAE,CAACC,EAAE,CAACC,EAAE,CAAC,QAAQ,CAAC,CAClBC,IAAI,CAACC,GAAG,CAACC,GAAG,CAACC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;EAE/C,IAAAP,YAAM,EAACF,SAAS,CAACU,WAAW,CAAC,CAACP,EAAE,CAACC,EAAE,CAACO,CAAC,CAAC,QAAQ,CAAC;EAC/C,IAAAT,YAAM,EAACF,SAAS,CAACY,QAAQ,CAAC,CAACT,EAAE,CAACC,EAAE,CAACO,CAAC,CAAC,UAAU,CAAC;AAChD;AAEA,eAAevB,QAAQ,CAAC;EAACyB,UAAU;EAAEC,GAAG,GAAG;AAAK,CAAC,EAAE;EACjD,MAAMd,SAAS,GAAG,MAAM,IAAAC,yBAAgB,GAAE;EAC1C,MAAMc,MAAM,GAAG,IAAIC,sBAAU,CAACH,UAAU,CAAC,aAAa,CAAC,CAAC;EACxD,MAAMI,cAAc,GAAGJ,UAAU,CAAC,qBAAqB,CAAC;EAExD,IAAI,CAACC,GAAG,EAAE;IACR,MAAMI,MAAM,GAAG,MAAMlB,SAAS,CAACY,QAAQ,CAACG,MAAM,CAAC;IAC/C,IAAAb,YAAM,EAACgB,MAAM,CAAC,CAACf,EAAE,CAACgB,GAAG,CAACF,cAAc,CAAC;IACrC;EACF;EAEA,MAAMjB,SAAS,CAACc,GAAG,CAACC,MAAM,CAAC;EAC3B,IAAAb,YAAM,EAACa,MAAM,CAAC,CAACZ,EAAE,CAACgB,GAAG,CAACF,cAAc,CAAC;AACvC"}
|
|
@@ -5,7 +5,6 @@ var _marcRecord = require("@natlibfi/marc-record");
|
|
|
5
5
|
var _nonBreakingSpace = _interopRequireDefault(require("./non-breaking-space"));
|
|
6
6
|
var _fixura = require("@natlibfi/fixura");
|
|
7
7
|
var _fixugen = _interopRequireDefault(require("@natlibfi/fixugen"));
|
|
8
|
-
var _debug = _interopRequireDefault(require("debug"));
|
|
9
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
9
|
(0, _fixugen.default)({
|
|
11
10
|
callback,
|
|
@@ -19,7 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
18
|
before: () => testValidatorFactory()
|
|
20
19
|
}
|
|
21
20
|
});
|
|
22
|
-
const debug = (0, _debug.default)('@natlibfi/marc-record-validators-melinda/non-breaking-space:test');
|
|
23
21
|
async function testValidatorFactory() {
|
|
24
22
|
const validator = await (0, _nonBreakingSpace.default)();
|
|
25
23
|
(0, _chai.expect)(validator).to.be.an('object').that.has.any.keys('description', 'validate');
|
|
@@ -28,13 +26,8 @@ async function testValidatorFactory() {
|
|
|
28
26
|
}
|
|
29
27
|
async function callback({
|
|
30
28
|
getFixture,
|
|
31
|
-
enabled = true,
|
|
32
29
|
fix = false
|
|
33
30
|
}) {
|
|
34
|
-
if (enabled === false) {
|
|
35
|
-
debug('TEST SKIPPED!');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
31
|
const validator = await (0, _nonBreakingSpace.default)();
|
|
39
32
|
const record = new _marcRecord.MarcRecord(getFixture('record.json'));
|
|
40
33
|
const expectedResult = getFixture('expectedResult.json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"non-breaking-space.spec.js","names":["generateTests","callback","path","__dirname","useMetadataFile","recurse","fixura","reader","READERS","JSON","mocha","before","testValidatorFactory","
|
|
1
|
+
{"version":3,"file":"non-breaking-space.spec.js","names":["generateTests","callback","path","__dirname","useMetadataFile","recurse","fixura","reader","READERS","JSON","mocha","before","testValidatorFactory","validator","validatorFactory","expect","to","be","an","that","has","any","keys","description","a","validate","getFixture","fix","record","MarcRecord","expectedResult","result","eql"],"sources":["../src/non-breaking-space.spec.js"],"sourcesContent":["import {expect} from 'chai';\nimport {MarcRecord} from '@natlibfi/marc-record';\nimport validatorFactory from './non-breaking-space';\nimport {READERS} from '@natlibfi/fixura';\nimport generateTests from '@natlibfi/fixugen';\n\ngenerateTests({\n callback,\n path: [__dirname, '..', 'test-fixtures', 'non-breaking-space'],\n useMetadataFile: true,\n recurse: false,\n fixura: {\n reader: READERS.JSON\n },\n mocha: {\n before: () => testValidatorFactory()\n }\n});\n\nasync function testValidatorFactory() {\n const validator = await validatorFactory();\n\n expect(validator)\n .to.be.an('object')\n .that.has.any.keys('description', 'validate');\n\n expect(validator.description).to.be.a('string');\n expect(validator.validate).to.be.a('function');\n}\n\nasync function callback({getFixture, fix = false}) {\n const validator = await validatorFactory();\n const record = new MarcRecord(getFixture('record.json'));\n const expectedResult = getFixture('expectedResult.json');\n\n if (!fix) {\n const result = await validator.validate(record);\n expect(result).to.eql(expectedResult);\n return;\n }\n\n await validator.fix(record);\n expect(record).to.eql(expectedResult);\n}\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AAA8C;AAE9C,IAAAA,gBAAa,EAAC;EACZC,QAAQ;EACRC,IAAI,EAAE,CAACC,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,oBAAoB,CAAC;EAC9DC,eAAe,EAAE,IAAI;EACrBC,OAAO,EAAE,KAAK;EACdC,MAAM,EAAE;IACNC,MAAM,EAAEC,eAAO,CAACC;EAClB,CAAC;EACDC,KAAK,EAAE;IACLC,MAAM,EAAE,MAAMC,oBAAoB;EACpC;AACF,CAAC,CAAC;AAEF,eAAeA,oBAAoB,GAAG;EACpC,MAAMC,SAAS,GAAG,MAAM,IAAAC,yBAAgB,GAAE;EAE1C,IAAAC,YAAM,EAACF,SAAS,CAAC,CACdG,EAAE,CAACC,EAAE,CAACC,EAAE,CAAC,QAAQ,CAAC,CAClBC,IAAI,CAACC,GAAG,CAACC,GAAG,CAACC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;EAE/C,IAAAP,YAAM,EAACF,SAAS,CAACU,WAAW,CAAC,CAACP,EAAE,CAACC,EAAE,CAACO,CAAC,CAAC,QAAQ,CAAC;EAC/C,IAAAT,YAAM,EAACF,SAAS,CAACY,QAAQ,CAAC,CAACT,EAAE,CAACC,EAAE,CAACO,CAAC,CAAC,UAAU,CAAC;AAChD;AAEA,eAAevB,QAAQ,CAAC;EAACyB,UAAU;EAAEC,GAAG,GAAG;AAAK,CAAC,EAAE;EACjD,MAAMd,SAAS,GAAG,MAAM,IAAAC,yBAAgB,GAAE;EAC1C,MAAMc,MAAM,GAAG,IAAIC,sBAAU,CAACH,UAAU,CAAC,aAAa,CAAC,CAAC;EACxD,MAAMI,cAAc,GAAGJ,UAAU,CAAC,qBAAqB,CAAC;EAExD,IAAI,CAACC,GAAG,EAAE;IACR,MAAMI,MAAM,GAAG,MAAMlB,SAAS,CAACY,QAAQ,CAACG,MAAM,CAAC;IAC/C,IAAAb,YAAM,EAACgB,MAAM,CAAC,CAACf,EAAE,CAACgB,GAAG,CAACF,cAAc,CAAC;IACrC;EACF;EAEA,MAAMjB,SAAS,CAACc,GAAG,CAACC,MAAM,CAAC;EAC3B,IAAAb,YAAM,EAACa,MAAM,CAAC,CAACZ,EAAE,CAACgB,GAAG,CAACF,cAAc,CAAC;AACvC"}
|
package/package.json
CHANGED
package/src/ending-whitespace.js
CHANGED
|
@@ -21,6 +21,10 @@ export default function () {
|
|
|
21
21
|
/* eslint-disable functional/immutable-data,functional/no-conditional-statement */
|
|
22
22
|
function fix(record) {
|
|
23
23
|
record.fields.forEach(({subfields}) => {
|
|
24
|
+
if (subfields === undefined) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
24
28
|
subfields.forEach(subfield => {
|
|
25
29
|
if (valueEndsWithWhitespace(subfield)) {
|
|
26
30
|
subfield.value = subfield.value.trimEnd();
|
|
@@ -3,7 +3,6 @@ import {MarcRecord} from '@natlibfi/marc-record';
|
|
|
3
3
|
import validatorFactory from './ending-whitespace';
|
|
4
4
|
import {READERS} from '@natlibfi/fixura';
|
|
5
5
|
import generateTests from '@natlibfi/fixugen';
|
|
6
|
-
import createDebugLogger from 'debug';
|
|
7
6
|
|
|
8
7
|
generateTests({
|
|
9
8
|
callback,
|
|
@@ -17,7 +16,6 @@ generateTests({
|
|
|
17
16
|
before: () => testValidatorFactory()
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/ending-whitespace:test');
|
|
21
19
|
|
|
22
20
|
async function testValidatorFactory() {
|
|
23
21
|
const validator = await validatorFactory();
|
|
@@ -30,12 +28,7 @@ async function testValidatorFactory() {
|
|
|
30
28
|
expect(validator.validate).to.be.a('function');
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
async function callback({getFixture,
|
|
34
|
-
if (enabled === false) {
|
|
35
|
-
debug('TEST SKIPPED!');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
31
|
+
async function callback({getFixture, fix = false}) {
|
|
39
32
|
const validator = await validatorFactory();
|
|
40
33
|
const record = new MarcRecord(getFixture('record.json'));
|
|
41
34
|
const expectedResult = getFixture('expectedResult.json');
|
|
@@ -3,7 +3,6 @@ import {MarcRecord} from '@natlibfi/marc-record';
|
|
|
3
3
|
import validatorFactory from './non-breaking-space';
|
|
4
4
|
import {READERS} from '@natlibfi/fixura';
|
|
5
5
|
import generateTests from '@natlibfi/fixugen';
|
|
6
|
-
import createDebugLogger from 'debug';
|
|
7
6
|
|
|
8
7
|
generateTests({
|
|
9
8
|
callback,
|
|
@@ -17,7 +16,6 @@ generateTests({
|
|
|
17
16
|
before: () => testValidatorFactory()
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/non-breaking-space:test');
|
|
21
19
|
|
|
22
20
|
async function testValidatorFactory() {
|
|
23
21
|
const validator = await validatorFactory();
|
|
@@ -30,12 +28,7 @@ async function testValidatorFactory() {
|
|
|
30
28
|
expect(validator.validate).to.be.a('function');
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
async function callback({getFixture,
|
|
34
|
-
if (enabled === false) {
|
|
35
|
-
debug('TEST SKIPPED!');
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
31
|
+
async function callback({getFixture, fix = false}) {
|
|
39
32
|
const validator = await validatorFactory();
|
|
40
33
|
const record = new MarcRecord(getFixture('record.json'));
|
|
41
34
|
const expectedResult = getFixture('expectedResult.json');
|