@natlibfi/marc-record-validators-melinda 12.0.0-alpha.1 → 12.0.0-alpha.12
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/.github/workflows/{melinda-node-tests.yml → melinda-node-tests-and-publish.yml} +36 -11
- 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/double-commas.test.js +1 -1
- package/dist/double-commas.test.js.map +1 -1
- package/dist/empty-fields.test.js +1 -1
- package/dist/empty-fields.test.js.map +1 -1
- package/dist/ending-punctuation-conf.js +6 -4
- package/dist/ending-punctuation-conf.js.map +2 -2
- package/dist/ending-punctuation.js +88 -18
- package/dist/ending-punctuation.js.map +3 -3
- package/dist/ending-punctuation.test.js +198 -103
- package/dist/ending-punctuation.test.js.map +2 -2
- package/dist/field-008-18-34-character-groups.test.js +1 -1
- package/dist/field-008-18-34-character-groups.test.js.map +1 -1
- package/dist/field-structure.test.js +1 -1
- package/dist/field-structure.test.js.map +1 -1
- package/dist/index.js +122 -59
- package/dist/index.js.map +2 -2
- package/dist/indicator-fixes.js +11 -1
- package/dist/indicator-fixes.js.map +2 -2
- package/dist/isbn-issn.js +8 -5
- package/dist/isbn-issn.js.map +2 -2
- package/dist/melindaCustomMergeFields.js +1 -1
- package/dist/melindaCustomMergeFields.js.map +2 -2
- package/dist/merge-fields/counterpartField.js +5 -0
- package/dist/merge-fields/counterpartField.js.map +2 -2
- package/dist/merge-fields/dataProvenance.js +29 -0
- package/dist/merge-fields/dataProvenance.js.map +7 -0
- package/dist/merge-fields/index.js +11 -2
- package/dist/merge-fields/index.js.map +2 -2
- package/dist/merge-fields/mergeField.js +1 -1
- package/dist/merge-fields/mergeField.js.map +2 -2
- package/dist/merge-fields.test.js +4 -2
- package/dist/merge-fields.test.js.map +2 -2
- package/dist/mergeField500Lisapainokset.js +1 -1
- package/dist/mergeField500Lisapainokset.js.map +2 -2
- package/dist/normalizeFieldForComparison.js +24 -0
- package/dist/normalizeFieldForComparison.js.map +2 -2
- package/dist/punctuation2.js +11 -5
- package/dist/punctuation2.js.map +2 -2
- package/dist/removeInferiorDataFields.js +2 -1
- package/dist/removeInferiorDataFields.js.map +2 -2
- package/dist/resolveOrphanedSubfield6s.js +1 -1
- package/dist/resolveOrphanedSubfield6s.js.map +2 -2
- package/dist/sortSubfields.js +5 -5
- package/dist/sortSubfields.js.map +2 -2
- package/dist/translate-terms.test.js +12 -2
- package/dist/translate-terms.test.js.map +2 -2
- package/dist/utils.js +9 -3
- package/dist/utils.js.map +2 -2
- package/package.json +22 -23
- 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/double-commas.test.js +1 -1
- package/src/empty-fields.test.js +1 -1
- package/src/ending-punctuation-conf.js +6 -5
- package/src/ending-punctuation.js +115 -24
- package/src/ending-punctuation.test.js +187 -104
- package/src/field-008-18-34-character-groups.test.js +1 -1
- package/src/field-structure.test.js +1 -1
- package/src/index.js +132 -59
- package/src/indicator-fixes.js +14 -1
- package/src/isbn-issn.js +11 -6
- package/src/melindaCustomMergeFields.js +1 -1
- package/src/merge-fields/counterpartField.js +6 -0
- package/src/merge-fields/dataProvenance.js +41 -0
- package/src/merge-fields/index.js +11 -2
- package/src/merge-fields/mergeField.js +2 -2
- package/src/merge-fields.test.js +6 -2
- package/src/mergeField500Lisapainokset.js +1 -1
- package/src/normalizeFieldForComparison.js +26 -0
- package/src/punctuation2.js +14 -5
- package/src/removeInferiorDataFields.js +4 -1
- package/src/resolveOrphanedSubfield6s.js +1 -1
- package/src/sortSubfields.js +7 -5
- package/src/translate-terms.test.js +25 -2
- package/src/utils.js +19 -3
- package/test-fixtures/indicator-fixes/10/expectedResult.json +11 -0
- package/test-fixtures/indicator-fixes/10/metadata.json +4 -0
- package/test-fixtures/indicator-fixes/10/record.json +11 -0
- package/test-fixtures/merge-fields/f05/expectedResult.json +24 -0
- package/test-fixtures/merge-fields/f05/metadata.json +6 -0
- package/test-fixtures/merge-fields/f05/record.json +30 -0
- package/test-fixtures/remove-inferior-datafields/f16/expectedResult.json +12 -0
- package/test-fixtures/remove-inferior-datafields/f16/metadata.json +5 -0
- package/test-fixtures/remove-inferior-datafields/f16/record.json +14 -0
- package/test-fixtures/translate-terms-data.js +42 -0
- package/src/melindaCustomMergeFields.json +0 -5120
|
@@ -12,11 +12,21 @@ describe("ending-punctuation", () => {
|
|
|
12
12
|
ind1: " ",
|
|
13
13
|
ind2: " ",
|
|
14
14
|
subfields: [
|
|
15
|
-
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /
|
|
15
|
+
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /" },
|
|
16
16
|
{ code: "c", value: "Roald Amundsen ; suomentanut Sulo Veikko Pekkola." },
|
|
17
17
|
{ code: "6", value: "FOO" }
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
// Hackily putting 2nd 245 here
|
|
22
|
+
tag: "245",
|
|
23
|
+
ind1: "0",
|
|
24
|
+
ind2: "4",
|
|
25
|
+
subfields: [
|
|
26
|
+
{ code: "a", value: "The Disaster /" },
|
|
27
|
+
{ code: "c", value: "(J.L.)." }
|
|
28
|
+
]
|
|
29
|
+
},
|
|
20
30
|
{
|
|
21
31
|
tag: "337",
|
|
22
32
|
// Range 336-338
|
|
@@ -33,7 +43,21 @@ describe("ending-punctuation", () => {
|
|
|
33
43
|
// Range 500-509
|
|
34
44
|
ind1: " ",
|
|
35
45
|
ind2: " ",
|
|
36
|
-
subfields: [{ code: "a", value: "FOO (Bar)" }]
|
|
46
|
+
subfields: [{ code: "a", value: "FOO (Bar)." }]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
tag: "500",
|
|
50
|
+
// Range 500-509
|
|
51
|
+
ind1: " ",
|
|
52
|
+
ind2: " ",
|
|
53
|
+
subfields: [{ code: "a", value: '"Lorum ipsum."' }]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
tag: "500",
|
|
57
|
+
// Range 500-509
|
|
58
|
+
ind1: " ",
|
|
59
|
+
ind2: " ",
|
|
60
|
+
subfields: [{ code: "a", value: 'Foo "Bar".' }]
|
|
37
61
|
}
|
|
38
62
|
]
|
|
39
63
|
});
|
|
@@ -45,9 +69,20 @@ describe("ending-punctuation", () => {
|
|
|
45
69
|
ind1: " ",
|
|
46
70
|
ind2: " ",
|
|
47
71
|
subfields: [
|
|
48
|
-
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /
|
|
72
|
+
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /" },
|
|
49
73
|
{ code: "c", value: "Roald Amundsen ; suomentanut Sulo Veikko Pekkola" },
|
|
50
74
|
{ code: "6", value: "FOO" }
|
|
75
|
+
// NV: not changing this now, but this is wrong: $6 is *always* the first subfield. Also , the value is not valid for $6...
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
// Hackily putting 2nd 245 here
|
|
80
|
+
tag: "245",
|
|
81
|
+
ind1: "0",
|
|
82
|
+
ind2: "4",
|
|
83
|
+
subfields: [
|
|
84
|
+
{ code: "a", value: "The Disaster /" },
|
|
85
|
+
{ code: "c", value: "(J.L.)" }
|
|
51
86
|
]
|
|
52
87
|
},
|
|
53
88
|
{
|
|
@@ -57,7 +92,7 @@ describe("ending-punctuation", () => {
|
|
|
57
92
|
subfields: [
|
|
58
93
|
{ code: "a", value: "k\xE4ytett\xE4viss\xE4 ilman laitetta" },
|
|
59
94
|
{ code: "b", value: "n." },
|
|
60
|
-
// This can be abbreviation -> does not generate error
|
|
95
|
+
// This can be abbreviation -> does not generate error (NV: huh?!?)
|
|
61
96
|
{ code: "2", value: "rdamedia" }
|
|
62
97
|
]
|
|
63
98
|
},
|
|
@@ -65,7 +100,21 @@ describe("ending-punctuation", () => {
|
|
|
65
100
|
tag: "500",
|
|
66
101
|
ind1: " ",
|
|
67
102
|
ind2: " ",
|
|
68
|
-
subfields: [{ code: "a", value: "FOO (Bar)
|
|
103
|
+
subfields: [{ code: "a", value: "FOO (Bar)" }]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
tag: "500",
|
|
107
|
+
// Range 500-509
|
|
108
|
+
ind1: " ",
|
|
109
|
+
ind2: " ",
|
|
110
|
+
subfields: [{ code: "a", value: '"Lorum ipsum.".' }]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
tag: "500",
|
|
114
|
+
// Range 500-509
|
|
115
|
+
ind1: " ",
|
|
116
|
+
ind2: " ",
|
|
117
|
+
subfields: [{ code: "a", value: 'Foo "Bar"' }]
|
|
69
118
|
}
|
|
70
119
|
]
|
|
71
120
|
});
|
|
@@ -77,11 +126,21 @@ describe("ending-punctuation", () => {
|
|
|
77
126
|
ind1: " ",
|
|
78
127
|
ind2: " ",
|
|
79
128
|
subfields: [
|
|
80
|
-
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /
|
|
129
|
+
{ code: "a", value: "El\xE4m\xE4ni ja tutkimusretkeni /" },
|
|
81
130
|
{ code: "c", value: "Roald Amundsen ; suomentanut Sulo Veikko Pekkola" },
|
|
82
131
|
{ code: "6", value: "FOO" }
|
|
83
132
|
]
|
|
84
133
|
},
|
|
134
|
+
{
|
|
135
|
+
// Hackily putting 2nd 245 here
|
|
136
|
+
tag: "245",
|
|
137
|
+
ind1: "0",
|
|
138
|
+
ind2: "4",
|
|
139
|
+
subfields: [
|
|
140
|
+
{ code: "a", value: "The Disaster /" },
|
|
141
|
+
{ code: "c", value: "(J.L.)" }
|
|
142
|
+
]
|
|
143
|
+
},
|
|
85
144
|
{
|
|
86
145
|
tag: "337",
|
|
87
146
|
ind1: " ",
|
|
@@ -89,7 +148,7 @@ describe("ending-punctuation", () => {
|
|
|
89
148
|
subfields: [
|
|
90
149
|
{ code: "a", value: "k\xE4ytett\xE4viss\xE4 ilman laitetta" },
|
|
91
150
|
{ code: "b", value: "n" },
|
|
92
|
-
// Dot removed from possible abbreviation as it cannot be removed in fixing
|
|
151
|
+
// Dot removed from possible abbreviation as it cannot be removed in fixing (NV: huh?)
|
|
93
152
|
{ code: "2", value: "rdamedia" }
|
|
94
153
|
]
|
|
95
154
|
},
|
|
@@ -97,7 +156,21 @@ describe("ending-punctuation", () => {
|
|
|
97
156
|
tag: "500",
|
|
98
157
|
ind1: " ",
|
|
99
158
|
ind2: " ",
|
|
100
|
-
subfields: [{ code: "a", value: "FOO (Bar)
|
|
159
|
+
subfields: [{ code: "a", value: "FOO (Bar)" }]
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
tag: "500",
|
|
163
|
+
// Range 500-509
|
|
164
|
+
ind1: " ",
|
|
165
|
+
ind2: " ",
|
|
166
|
+
subfields: [{ code: "a", value: '"Lorum ipsum.".' }]
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
tag: "500",
|
|
170
|
+
// Range 500-509
|
|
171
|
+
ind1: " ",
|
|
172
|
+
ind2: " ",
|
|
173
|
+
subfields: [{ code: "a", value: 'Foo "Bar"' }]
|
|
101
174
|
}
|
|
102
175
|
]
|
|
103
176
|
});
|
|
@@ -110,19 +183,19 @@ describe("ending-punctuation", () => {
|
|
|
110
183
|
const validator = await validatorFactory();
|
|
111
184
|
const result = await validator.validate(recordInvalid);
|
|
112
185
|
assert.deepEqual(result, {
|
|
113
|
-
message: ["Field 245
|
|
186
|
+
message: ["Field 245 requires ending punctuation, ends in 'a'", "Field 245 requires ending punctuation, ends in ')'", "Field 500 requires ending punctuation, ends in ')'", `Field 500 has an extra dot in '.".'`, `Field 500 requires ending punctuation, ends in '"'`],
|
|
114
187
|
valid: false
|
|
115
188
|
});
|
|
116
189
|
});
|
|
117
190
|
it("Repairs the invalid record", async () => {
|
|
118
191
|
const validator = await validatorFactory();
|
|
119
192
|
const result = await validator.fix(recordBroken);
|
|
120
|
-
assert.equal(recordBroken.equalsTo(recordValid), true);
|
|
121
193
|
assert.deepEqual(result, {
|
|
122
|
-
message: ["Field 245
|
|
123
|
-
fix: ["Field 245 - Added punctuation to $c", "Field 500 - Removed
|
|
194
|
+
message: ["Field 245 requires ending punctuation, ends in 'a'", "Field 245 requires ending punctuation, ends in ')'", "Field 500 requires ending punctuation, ends in ')'", `Field 500 has an extra dot in '.".'`, `Field 500 requires ending punctuation, ends in '"'`],
|
|
195
|
+
fix: ["Field 245 - Added punctuation to $c", "Field 245 - Added punctuation to $c", "Field 500 - Added punctuation to $a", `Field 500 - Removed '.' after '."'`, "Field 500 - Added punctuation to $a"],
|
|
124
196
|
valid: false
|
|
125
197
|
});
|
|
198
|
+
assert.equal(recordBroken.equalsTo(recordValid), true);
|
|
126
199
|
});
|
|
127
200
|
});
|
|
128
201
|
describe("#specials", () => {
|
|
@@ -192,7 +265,7 @@ describe("ending-punctuation", () => {
|
|
|
192
265
|
const validator = await validatorFactory();
|
|
193
266
|
const result = await validator.validate(recordInvalid);
|
|
194
267
|
assert.deepEqual(result, {
|
|
195
|
-
message: ["Field 036
|
|
268
|
+
message: ["Field 036 requires ending punctuation, ends in 'e'"],
|
|
196
269
|
valid: false
|
|
197
270
|
});
|
|
198
271
|
});
|
|
@@ -200,7 +273,7 @@ describe("ending-punctuation", () => {
|
|
|
200
273
|
const validator = await validatorFactory();
|
|
201
274
|
const result = await validator.validate(recordInvalidOnlyA);
|
|
202
275
|
assert.deepEqual(result, {
|
|
203
|
-
message: ["Field 036 has
|
|
276
|
+
message: ["Field 036 has unwanted ending punctuation '.'"],
|
|
204
277
|
valid: false
|
|
205
278
|
});
|
|
206
279
|
});
|
|
@@ -209,7 +282,7 @@ describe("ending-punctuation", () => {
|
|
|
209
282
|
const result = await validator.fix(recordInvalid);
|
|
210
283
|
assert.equal(recordInvalid.equalsTo(recordValid), true);
|
|
211
284
|
assert.deepEqual(result, {
|
|
212
|
-
message: ["Field 036
|
|
285
|
+
message: ["Field 036 requires ending punctuation, ends in 'e'"],
|
|
213
286
|
fix: ["Field 036 - Added punctuation to $b"],
|
|
214
287
|
valid: false
|
|
215
288
|
});
|
|
@@ -219,7 +292,7 @@ describe("ending-punctuation", () => {
|
|
|
219
292
|
const result = await validator.fix(recordInvalidOnlyA);
|
|
220
293
|
assert.equal(recordInvalidOnlyA.equalsTo(recordValidOnlyA), true);
|
|
221
294
|
assert.deepEqual(result, {
|
|
222
|
-
message: ["Field 036 has
|
|
295
|
+
message: ["Field 036 has unwanted ending punctuation '.'"],
|
|
223
296
|
fix: ["Field 036 - Removed punctuation from $a"],
|
|
224
297
|
valid: false
|
|
225
298
|
});
|
|
@@ -357,7 +430,7 @@ describe("ending-punctuation", () => {
|
|
|
357
430
|
const validator = await validatorFactory();
|
|
358
431
|
const result = await validator.validate(recordInvalidOnlyAMissingA);
|
|
359
432
|
assert.deepEqual(result, {
|
|
360
|
-
message: ["Field 242
|
|
433
|
+
message: ["Field 242 requires ending punctuation, ends in 't'"],
|
|
361
434
|
valid: false
|
|
362
435
|
});
|
|
363
436
|
});
|
|
@@ -365,7 +438,7 @@ describe("ending-punctuation", () => {
|
|
|
365
438
|
const validator = await validatorFactory();
|
|
366
439
|
const result = await validator.validate(recordInvalidOnlyAPuncY);
|
|
367
440
|
assert.deepEqual(result, {
|
|
368
|
-
message: ["Field 242 has
|
|
441
|
+
message: ["Field 242 has unwanted ending punctuation '.'"],
|
|
369
442
|
valid: false
|
|
370
443
|
});
|
|
371
444
|
});
|
|
@@ -373,7 +446,7 @@ describe("ending-punctuation", () => {
|
|
|
373
446
|
const validator = await validatorFactory();
|
|
374
447
|
const result = await validator.validate(recordInvalidOnlyAMissingAPuncY);
|
|
375
448
|
assert.deepEqual(result, {
|
|
376
|
-
message: ["Field 242 has
|
|
449
|
+
message: ["Field 242 has unwanted ending punctuation '.'", "Field 242 requires ending punctuation, ends in 't'"],
|
|
377
450
|
valid: false
|
|
378
451
|
});
|
|
379
452
|
});
|
|
@@ -381,7 +454,7 @@ describe("ending-punctuation", () => {
|
|
|
381
454
|
const validator = await validatorFactory();
|
|
382
455
|
const result = await validator.validate(recordValidMultipleMissingP);
|
|
383
456
|
assert.deepEqual(result, {
|
|
384
|
-
message: ["Field 242
|
|
457
|
+
message: ["Field 242 requires ending punctuation, ends in 'y'"],
|
|
385
458
|
valid: false
|
|
386
459
|
});
|
|
387
460
|
});
|
|
@@ -389,7 +462,7 @@ describe("ending-punctuation", () => {
|
|
|
389
462
|
const validator = await validatorFactory();
|
|
390
463
|
const result = await validator.validate(recordValidWithoutYMissingA);
|
|
391
464
|
assert.deepEqual(result, {
|
|
392
|
-
message: ["Field 242
|
|
465
|
+
message: ["Field 242 requires ending punctuation, ends in 't'"],
|
|
393
466
|
valid: false
|
|
394
467
|
});
|
|
395
468
|
});
|
|
@@ -398,7 +471,7 @@ describe("ending-punctuation", () => {
|
|
|
398
471
|
const result = await validator.fix(recordInvalidOnlyAMissingA);
|
|
399
472
|
assert.equal(recordInvalidOnlyAMissingA.equalsTo(recordValidOnlyA), true);
|
|
400
473
|
assert.deepEqual(result, {
|
|
401
|
-
message: ["Field 242
|
|
474
|
+
message: ["Field 242 requires ending punctuation, ends in 't'"],
|
|
402
475
|
fix: ["Field 242 - Added punctuation to $a"],
|
|
403
476
|
valid: false
|
|
404
477
|
});
|
|
@@ -408,7 +481,7 @@ describe("ending-punctuation", () => {
|
|
|
408
481
|
const result = await validator.fix(recordInvalidOnlyAPuncY);
|
|
409
482
|
assert.equal(recordInvalidOnlyAPuncY.equalsTo(recordValidOnlyA), true);
|
|
410
483
|
assert.deepEqual(result, {
|
|
411
|
-
message: ["Field 242 has
|
|
484
|
+
message: ["Field 242 has unwanted ending punctuation '.'"],
|
|
412
485
|
fix: ["Field 242 - Removed punctuation from $y"],
|
|
413
486
|
valid: false
|
|
414
487
|
});
|
|
@@ -418,7 +491,7 @@ describe("ending-punctuation", () => {
|
|
|
418
491
|
const result = await validator.fix(recordInvalidOnlyAMissingAPuncY);
|
|
419
492
|
assert.equal(recordInvalidOnlyAMissingAPuncY.equalsTo(recordValidOnlyA), true);
|
|
420
493
|
assert.deepEqual(result, {
|
|
421
|
-
message: ["Field 242 has
|
|
494
|
+
message: ["Field 242 has unwanted ending punctuation '.'", "Field 242 requires ending punctuation, ends in 't'"],
|
|
422
495
|
fix: ["Field 242 - Removed punctuation from $y", "Field 242 - Added punctuation to $a"],
|
|
423
496
|
valid: false
|
|
424
497
|
});
|
|
@@ -428,7 +501,7 @@ describe("ending-punctuation", () => {
|
|
|
428
501
|
const result = await validator.fix(recordValidMultipleMissingP);
|
|
429
502
|
assert.equal(recordValidMultipleMissingP.equalsTo(recordValidMultiple), true);
|
|
430
503
|
assert.deepEqual(result, {
|
|
431
|
-
message: ["Field 242
|
|
504
|
+
message: ["Field 242 requires ending punctuation, ends in 'y'"],
|
|
432
505
|
fix: ["Field 242 - Added punctuation to $p"],
|
|
433
506
|
valid: false
|
|
434
507
|
});
|
|
@@ -438,7 +511,7 @@ describe("ending-punctuation", () => {
|
|
|
438
511
|
const result = await validator.fix(recordValidWithoutYMissingA);
|
|
439
512
|
assert.equal(recordValidWithoutYMissingA.equalsTo(recordValidWithoutY), true);
|
|
440
513
|
assert.deepEqual(result, {
|
|
441
|
-
message: ["Field 242
|
|
514
|
+
message: ["Field 242 requires ending punctuation, ends in 't'"],
|
|
442
515
|
fix: ["Field 242 - Added punctuation to $a"],
|
|
443
516
|
valid: false
|
|
444
517
|
});
|
|
@@ -541,7 +614,7 @@ describe("ending-punctuation", () => {
|
|
|
541
614
|
const validator = await validatorFactory();
|
|
542
615
|
const result = await validator.validate(recordInvalidEndC);
|
|
543
616
|
assert.deepEqual(result, {
|
|
544
|
-
message: ["Field 260
|
|
617
|
+
message: ["Field 260 requires ending punctuation, ends in '2'"],
|
|
545
618
|
valid: false
|
|
546
619
|
});
|
|
547
620
|
});
|
|
@@ -549,7 +622,7 @@ describe("ending-punctuation", () => {
|
|
|
549
622
|
const validator = await validatorFactory();
|
|
550
623
|
const result = await validator.validate(recordInvalidEndGDouble);
|
|
551
624
|
assert.deepEqual(result, {
|
|
552
|
-
message: ["Field 260 has
|
|
625
|
+
message: ["Field 260 has an extra dot after ')'"],
|
|
553
626
|
valid: false
|
|
554
627
|
});
|
|
555
628
|
});
|
|
@@ -558,7 +631,7 @@ describe("ending-punctuation", () => {
|
|
|
558
631
|
const result = await validator.fix(recordInvalidEndC);
|
|
559
632
|
assert.equal(recordInvalidEndC.equalsTo(recordValidEndC), true);
|
|
560
633
|
assert.deepEqual(result, {
|
|
561
|
-
message: ["Field 260
|
|
634
|
+
message: ["Field 260 requires ending punctuation, ends in '2'"],
|
|
562
635
|
fix: ["Field 260 - Added punctuation to $c"],
|
|
563
636
|
valid: false
|
|
564
637
|
});
|
|
@@ -568,8 +641,8 @@ describe("ending-punctuation", () => {
|
|
|
568
641
|
const result = await validator.fix(recordInvalidEndGDouble);
|
|
569
642
|
assert.equal(recordInvalidEndGDouble.equalsTo(recordValidEndG), true);
|
|
570
643
|
assert.deepEqual(result, {
|
|
571
|
-
message: ["Field 260 has
|
|
572
|
-
fix: ["Field 260 - Removed
|
|
644
|
+
message: ["Field 260 has an extra dot after ')'"],
|
|
645
|
+
fix: ["Field 260 - Removed dot after punctuation from $g"],
|
|
573
646
|
valid: false
|
|
574
647
|
});
|
|
575
648
|
});
|
|
@@ -688,7 +761,7 @@ describe("ending-punctuation", () => {
|
|
|
688
761
|
const validator = await validatorFactory();
|
|
689
762
|
const result = await validator.validate(recordInvalidInd2v1);
|
|
690
763
|
assert.deepEqual(result, {
|
|
691
|
-
message: ["Field 264
|
|
764
|
+
message: ["Field 264 requires ending punctuation, ends in '6'"],
|
|
692
765
|
valid: false
|
|
693
766
|
});
|
|
694
767
|
});
|
|
@@ -696,7 +769,7 @@ describe("ending-punctuation", () => {
|
|
|
696
769
|
const validator = await validatorFactory();
|
|
697
770
|
const result = await validator.validate(recordInvalidCopyrightCExtra);
|
|
698
771
|
assert.deepEqual(result, {
|
|
699
|
-
message: ["Field 264 has
|
|
772
|
+
message: ["Field 264 has unwanted ending punctuation '.'"],
|
|
700
773
|
valid: false
|
|
701
774
|
});
|
|
702
775
|
});
|
|
@@ -705,7 +778,7 @@ describe("ending-punctuation", () => {
|
|
|
705
778
|
const result = await validator.fix(recordInvalidInd2v1);
|
|
706
779
|
assert.equal(recordInvalidInd2v1.equalsTo(recordValidInd2v1), true);
|
|
707
780
|
assert.deepEqual(result, {
|
|
708
|
-
message: ["Field 264
|
|
781
|
+
message: ["Field 264 requires ending punctuation, ends in '6'"],
|
|
709
782
|
fix: ["Field 264 - Added punctuation to $c"],
|
|
710
783
|
valid: false
|
|
711
784
|
});
|
|
@@ -715,7 +788,7 @@ describe("ending-punctuation", () => {
|
|
|
715
788
|
const result = await validator.fix(recordInvalidCopyrightCExtra);
|
|
716
789
|
assert.equal(recordInvalidCopyrightCExtra.equalsTo(recordValidCopyright), true);
|
|
717
790
|
assert.deepEqual(result, {
|
|
718
|
-
message: ["Field 264 has
|
|
791
|
+
message: ["Field 264 has unwanted ending punctuation '.'"],
|
|
719
792
|
fix: ["Field 264 - Removed punctuation from $c"],
|
|
720
793
|
valid: false
|
|
721
794
|
});
|
|
@@ -898,7 +971,7 @@ describe("ending-punctuation", () => {
|
|
|
898
971
|
const validator = await validatorFactory();
|
|
899
972
|
const result = await validator.validate(recordInvalidA);
|
|
900
973
|
assert.deepEqual(result, {
|
|
901
|
-
message: ["Field 340
|
|
974
|
+
message: ["Field 340 requires ending punctuation, ends in 'e'"],
|
|
902
975
|
valid: false
|
|
903
976
|
});
|
|
904
977
|
});
|
|
@@ -906,7 +979,7 @@ describe("ending-punctuation", () => {
|
|
|
906
979
|
const validator = await validatorFactory();
|
|
907
980
|
const result = await validator.validate(recordInvalidAMissingB);
|
|
908
981
|
assert.deepEqual(result, {
|
|
909
|
-
message: ["Field 340
|
|
982
|
+
message: ["Field 340 requires ending punctuation, ends in 't'"],
|
|
910
983
|
valid: false
|
|
911
984
|
});
|
|
912
985
|
});
|
|
@@ -914,7 +987,7 @@ describe("ending-punctuation", () => {
|
|
|
914
987
|
const validator = await validatorFactory();
|
|
915
988
|
const result = await validator.validate(recordInvalidABMissing);
|
|
916
989
|
assert.deepEqual(result, {
|
|
917
|
-
message: ["Field 340
|
|
990
|
+
message: ["Field 340 requires ending punctuation, ends in 'm'"],
|
|
918
991
|
valid: false
|
|
919
992
|
});
|
|
920
993
|
});
|
|
@@ -922,7 +995,7 @@ describe("ending-punctuation", () => {
|
|
|
922
995
|
const validator = await validatorFactory();
|
|
923
996
|
const result = await validator.validate(recordInvalidDDMissing);
|
|
924
997
|
assert.deepEqual(result, {
|
|
925
|
-
message: ["Field 340
|
|
998
|
+
message: ["Field 340 requires ending punctuation, ends in 'd'"],
|
|
926
999
|
valid: false
|
|
927
1000
|
});
|
|
928
1001
|
});
|
|
@@ -930,7 +1003,7 @@ describe("ending-punctuation", () => {
|
|
|
930
1003
|
const validator = await validatorFactory();
|
|
931
1004
|
const result = await validator.validate(recordInvalidComplexDMissing);
|
|
932
1005
|
assert.deepEqual(result, {
|
|
933
|
-
message: ["Field 340
|
|
1006
|
+
message: ["Field 340 requires ending punctuation, ends in 'e'"],
|
|
934
1007
|
valid: false
|
|
935
1008
|
});
|
|
936
1009
|
});
|
|
@@ -939,7 +1012,7 @@ describe("ending-punctuation", () => {
|
|
|
939
1012
|
const result = await validator.fix(recordInvalidA);
|
|
940
1013
|
assert.equal(recordInvalidA.equalsTo(recordInvalidA), true);
|
|
941
1014
|
assert.deepEqual(result, {
|
|
942
|
-
message: ["Field 340
|
|
1015
|
+
message: ["Field 340 requires ending punctuation, ends in 'e'"],
|
|
943
1016
|
fix: ["Field 340 - Added punctuation to $a"],
|
|
944
1017
|
valid: false
|
|
945
1018
|
});
|
|
@@ -949,7 +1022,7 @@ describe("ending-punctuation", () => {
|
|
|
949
1022
|
const result = await validator.fix(recordInvalidAMissingB);
|
|
950
1023
|
assert.equal(recordInvalidAMissingB.equalsTo(recordValidAB), true);
|
|
951
1024
|
assert.deepEqual(result, {
|
|
952
|
-
message: ["Field 340
|
|
1025
|
+
message: ["Field 340 requires ending punctuation, ends in 't'"],
|
|
953
1026
|
fix: ["Field 340 - Added punctuation to $a"],
|
|
954
1027
|
valid: false
|
|
955
1028
|
});
|
|
@@ -959,7 +1032,7 @@ describe("ending-punctuation", () => {
|
|
|
959
1032
|
const result = await validator.fix(recordInvalidABMissing);
|
|
960
1033
|
assert.equal(recordInvalidABMissing.equalsTo(recordValidAB), true);
|
|
961
1034
|
assert.deepEqual(result, {
|
|
962
|
-
message: ["Field 340
|
|
1035
|
+
message: ["Field 340 requires ending punctuation, ends in 'm'"],
|
|
963
1036
|
fix: ["Field 340 - Added punctuation to $b"],
|
|
964
1037
|
valid: false
|
|
965
1038
|
});
|
|
@@ -969,7 +1042,7 @@ describe("ending-punctuation", () => {
|
|
|
969
1042
|
const result = await validator.fix(recordInvalidDDMissing);
|
|
970
1043
|
assert.equal(recordInvalidDDMissing.equalsTo(recordValidDD), true);
|
|
971
1044
|
assert.deepEqual(result, {
|
|
972
|
-
message: ["Field 340
|
|
1045
|
+
message: ["Field 340 requires ending punctuation, ends in 'd'"],
|
|
973
1046
|
fix: ["Field 340 - Added punctuation to $d"],
|
|
974
1047
|
valid: false
|
|
975
1048
|
});
|
|
@@ -979,7 +1052,7 @@ describe("ending-punctuation", () => {
|
|
|
979
1052
|
const result = await validator.fix(recordInvalidComplexDMissing);
|
|
980
1053
|
assert.equal(recordInvalidComplexDMissing.equalsTo(recordInvalidComplexDMissing), true);
|
|
981
1054
|
assert.deepEqual(result, {
|
|
982
|
-
message: ["Field 340
|
|
1055
|
+
message: ["Field 340 requires ending punctuation, ends in 'e'"],
|
|
983
1056
|
fix: ["Field 340 - Added punctuation to $d"],
|
|
984
1057
|
valid: false
|
|
985
1058
|
});
|
|
@@ -1071,7 +1144,7 @@ describe("ending-punctuation", () => {
|
|
|
1071
1144
|
const validator = await validatorFactory();
|
|
1072
1145
|
const result = await validator.validate(recordInvalid);
|
|
1073
1146
|
assert.deepEqual(result, {
|
|
1074
|
-
message: ["Field 520
|
|
1147
|
+
message: ["Field 520 requires ending punctuation, ends in '\xF6'"],
|
|
1075
1148
|
valid: false
|
|
1076
1149
|
});
|
|
1077
1150
|
});
|
|
@@ -1079,7 +1152,7 @@ describe("ending-punctuation", () => {
|
|
|
1079
1152
|
const validator = await validatorFactory();
|
|
1080
1153
|
const result = await validator.validate(recordInvalidWithU);
|
|
1081
1154
|
assert.deepEqual(result, {
|
|
1082
|
-
message: ["Field 520
|
|
1155
|
+
message: ["Field 520 requires ending punctuation, ends in 'i'"],
|
|
1083
1156
|
valid: false
|
|
1084
1157
|
});
|
|
1085
1158
|
});
|
|
@@ -1088,7 +1161,7 @@ describe("ending-punctuation", () => {
|
|
|
1088
1161
|
const result = await validator.fix(recordInvalid);
|
|
1089
1162
|
assert.equal(recordInvalid.equalsTo(recordValid), true);
|
|
1090
1163
|
assert.deepEqual(result, {
|
|
1091
|
-
message: ["Field 520
|
|
1164
|
+
message: ["Field 520 requires ending punctuation, ends in '\xF6'"],
|
|
1092
1165
|
fix: ["Field 520 - Added punctuation to $a"],
|
|
1093
1166
|
valid: false
|
|
1094
1167
|
});
|
|
@@ -1098,7 +1171,7 @@ describe("ending-punctuation", () => {
|
|
|
1098
1171
|
const result = await validator.fix(recordInvalidWithU);
|
|
1099
1172
|
assert.equal(recordInvalidWithU.equalsTo(recordValidWithU), true);
|
|
1100
1173
|
assert.deepEqual(result, {
|
|
1101
|
-
message: ["Field 520
|
|
1174
|
+
message: ["Field 520 requires ending punctuation, ends in 'i'"],
|
|
1102
1175
|
fix: ["Field 520 - Added punctuation to $a"],
|
|
1103
1176
|
valid: false
|
|
1104
1177
|
});
|
|
@@ -1208,7 +1281,7 @@ describe("ending-punctuation", () => {
|
|
|
1208
1281
|
const validator = await validatorFactory();
|
|
1209
1282
|
const result = await validator.validate(recordInvalidMissingI);
|
|
1210
1283
|
assert.deepEqual(result, {
|
|
1211
|
-
message: ["Field 538
|
|
1284
|
+
message: ["Field 538 requires ending punctuation, ends in 's'"],
|
|
1212
1285
|
valid: false
|
|
1213
1286
|
});
|
|
1214
1287
|
});
|
|
@@ -1216,7 +1289,7 @@ describe("ending-punctuation", () => {
|
|
|
1216
1289
|
const validator = await validatorFactory();
|
|
1217
1290
|
const result = await validator.validate(recordInvalidI);
|
|
1218
1291
|
assert.deepEqual(result, {
|
|
1219
|
-
message: ["Field 538
|
|
1292
|
+
message: ["Field 538 requires ending punctuation, ends in ':'"],
|
|
1220
1293
|
valid: false
|
|
1221
1294
|
});
|
|
1222
1295
|
});
|
|
@@ -1224,7 +1297,7 @@ describe("ending-punctuation", () => {
|
|
|
1224
1297
|
const validator = await validatorFactory();
|
|
1225
1298
|
const result = await validator.validate(recordInvalidOnlyA);
|
|
1226
1299
|
assert.deepEqual(result, {
|
|
1227
|
-
message: ["Field 538
|
|
1300
|
+
message: ["Field 538 requires ending punctuation, ends in 'e'"],
|
|
1228
1301
|
valid: false
|
|
1229
1302
|
});
|
|
1230
1303
|
});
|
|
@@ -1233,7 +1306,7 @@ describe("ending-punctuation", () => {
|
|
|
1233
1306
|
const result = await validator.fix(recordInvalidMissingI);
|
|
1234
1307
|
assert.equal(recordInvalidMissingI.equalsTo(recordValid), true);
|
|
1235
1308
|
assert.deepEqual(result, {
|
|
1236
|
-
message: ["Field 538
|
|
1309
|
+
message: ["Field 538 requires ending punctuation, ends in 's'"],
|
|
1237
1310
|
fix: ["Field 538 - Added punctuation to $i"],
|
|
1238
1311
|
valid: false
|
|
1239
1312
|
});
|
|
@@ -1243,7 +1316,7 @@ describe("ending-punctuation", () => {
|
|
|
1243
1316
|
const result = await validator.fix(recordInvalidOnlyA);
|
|
1244
1317
|
assert.equal(recordInvalidOnlyA.equalsTo(recordValidOnlyA), true);
|
|
1245
1318
|
assert.deepEqual(result, {
|
|
1246
|
-
message: ["Field 538
|
|
1319
|
+
message: ["Field 538 requires ending punctuation, ends in 'e'"],
|
|
1247
1320
|
fix: ["Field 538 - Added punctuation to $a"],
|
|
1248
1321
|
valid: false
|
|
1249
1322
|
});
|
|
@@ -1314,7 +1387,7 @@ describe("ending-punctuation", () => {
|
|
|
1314
1387
|
const validator = await validatorFactory();
|
|
1315
1388
|
const result = await validator.validate(recordInvalid);
|
|
1316
1389
|
assert.deepEqual(result, {
|
|
1317
|
-
message: ["Field 567
|
|
1390
|
+
message: ["Field 567 requires ending punctuation, ends in 's'"],
|
|
1318
1391
|
valid: false
|
|
1319
1392
|
});
|
|
1320
1393
|
});
|
|
@@ -1322,7 +1395,7 @@ describe("ending-punctuation", () => {
|
|
|
1322
1395
|
const validator = await validatorFactory();
|
|
1323
1396
|
const result = await validator.validate(recordInvalidWithoutA);
|
|
1324
1397
|
assert.deepEqual(result, {
|
|
1325
|
-
message: ["Field 567 has
|
|
1398
|
+
message: ["Field 567 has unwanted ending punctuation '.'"],
|
|
1326
1399
|
valid: false
|
|
1327
1400
|
});
|
|
1328
1401
|
});
|
|
@@ -1331,7 +1404,7 @@ describe("ending-punctuation", () => {
|
|
|
1331
1404
|
const result = await validator.fix(recordInvalid);
|
|
1332
1405
|
assert.equal(recordInvalid.equalsTo(recordValid), true);
|
|
1333
1406
|
assert.deepEqual(result, {
|
|
1334
|
-
message: ["Field 567
|
|
1407
|
+
message: ["Field 567 requires ending punctuation, ends in 's'"],
|
|
1335
1408
|
fix: ["Field 567 - Added punctuation to $a"],
|
|
1336
1409
|
valid: false
|
|
1337
1410
|
});
|
|
@@ -1341,7 +1414,7 @@ describe("ending-punctuation", () => {
|
|
|
1341
1414
|
const result = await validator.fix(recordInvalidWithoutA);
|
|
1342
1415
|
assert.equal(recordInvalidWithoutA.equalsTo(recordValidWithoutA), true);
|
|
1343
1416
|
assert.deepEqual(result, {
|
|
1344
|
-
message: ["Field 567 has
|
|
1417
|
+
message: ["Field 567 has unwanted ending punctuation '.'"],
|
|
1345
1418
|
fix: ["Field 567 - Removed punctuation from $b"],
|
|
1346
1419
|
valid: false
|
|
1347
1420
|
});
|
|
@@ -1363,7 +1436,7 @@ describe("ending-punctuation", () => {
|
|
|
1363
1436
|
}
|
|
1364
1437
|
]
|
|
1365
1438
|
});
|
|
1366
|
-
const
|
|
1439
|
+
const recordValid648FinNo = new MarcRecord({
|
|
1367
1440
|
leader: "",
|
|
1368
1441
|
fields: [
|
|
1369
1442
|
{
|
|
@@ -1374,6 +1447,17 @@ describe("ending-punctuation", () => {
|
|
|
1374
1447
|
{ code: "a", value: "1900-luku" },
|
|
1375
1448
|
{ code: "2", value: "yso/swe" }
|
|
1376
1449
|
]
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
// Exception: term ending in dot:
|
|
1453
|
+
tag: "648",
|
|
1454
|
+
ind1: " ",
|
|
1455
|
+
ind2: "7",
|
|
1456
|
+
subfields: [
|
|
1457
|
+
{ code: "a", value: "1200-luku eaa." },
|
|
1458
|
+
{ code: "2", value: "yso/fin" },
|
|
1459
|
+
{ code: "0", value: "http://www.yso.fi/onto/yso/p1129911200" }
|
|
1460
|
+
]
|
|
1377
1461
|
}
|
|
1378
1462
|
]
|
|
1379
1463
|
});
|
|
@@ -1441,7 +1525,7 @@ describe("ending-punctuation", () => {
|
|
|
1441
1525
|
});
|
|
1442
1526
|
it("Finds record valid - 648 Finnish, without punc", async () => {
|
|
1443
1527
|
const validator = await validatorFactory();
|
|
1444
|
-
const result = await validator.validate(
|
|
1528
|
+
const result = await validator.validate(recordValid648FinNo);
|
|
1445
1529
|
assert.equal(result.valid, true);
|
|
1446
1530
|
});
|
|
1447
1531
|
it("Finds record valid - 648 Fast, without punc", async () => {
|
|
@@ -1479,7 +1563,7 @@ describe("ending-punctuation", () => {
|
|
|
1479
1563
|
}
|
|
1480
1564
|
]
|
|
1481
1565
|
});
|
|
1482
|
-
const
|
|
1566
|
+
const recordInvalid648FinYes = new MarcRecord({
|
|
1483
1567
|
leader: "",
|
|
1484
1568
|
fields: [
|
|
1485
1569
|
{
|
|
@@ -1490,6 +1574,17 @@ describe("ending-punctuation", () => {
|
|
|
1490
1574
|
{ code: "a", value: "1900-luku." },
|
|
1491
1575
|
{ code: "2", value: "yso/swe" }
|
|
1492
1576
|
]
|
|
1577
|
+
},
|
|
1578
|
+
{
|
|
1579
|
+
// Exception:
|
|
1580
|
+
tag: "648",
|
|
1581
|
+
ind1: " ",
|
|
1582
|
+
ind2: "7",
|
|
1583
|
+
subfields: [
|
|
1584
|
+
{ code: "a", value: "1200-luku eaa" },
|
|
1585
|
+
{ code: "2", value: "yso/fin" },
|
|
1586
|
+
{ code: "0", value: "http://www.yso.fi/onto/yso/p1129911200" }
|
|
1587
|
+
]
|
|
1493
1588
|
}
|
|
1494
1589
|
]
|
|
1495
1590
|
});
|
|
@@ -1553,15 +1648,15 @@ describe("ending-punctuation", () => {
|
|
|
1553
1648
|
const validator = await validatorFactory();
|
|
1554
1649
|
const result = await validator.validate(recordInvalid647FastEndPunc);
|
|
1555
1650
|
assert.deepEqual(result, {
|
|
1556
|
-
message: ["Field 647 has
|
|
1651
|
+
message: ["Field 647 has an extra dot after ')'"],
|
|
1557
1652
|
valid: false
|
|
1558
1653
|
});
|
|
1559
1654
|
});
|
|
1560
1655
|
it("Finds record invalid - 648 Finnish, with punc", async () => {
|
|
1561
1656
|
const validator = await validatorFactory();
|
|
1562
|
-
const result = await validator.validate(
|
|
1657
|
+
const result = await validator.validate(recordInvalid648FinYes);
|
|
1563
1658
|
assert.deepEqual(result, {
|
|
1564
|
-
message: ["Field 648 has
|
|
1659
|
+
message: ["Field 648 has unwanted ending punctuation '.'", "Field 648 requires ending punctuation, ends in 'a'"],
|
|
1565
1660
|
valid: false
|
|
1566
1661
|
});
|
|
1567
1662
|
});
|
|
@@ -1569,11 +1664,11 @@ describe("ending-punctuation", () => {
|
|
|
1569
1664
|
const validator = await validatorFactory();
|
|
1570
1665
|
const result = await validator.validate(recordInvalid648FastYes);
|
|
1571
1666
|
assert.deepEqual(result, {
|
|
1572
|
-
message: ["Field 648 has
|
|
1667
|
+
message: ["Field 648 has unwanted ending punctuation '.'"],
|
|
1573
1668
|
valid: false
|
|
1574
1669
|
});
|
|
1575
1670
|
});
|
|
1576
|
-
const invalidField650Message = "Field 650 has
|
|
1671
|
+
const invalidField650Message = "Field 650 has unwanted ending punctuation '.'";
|
|
1577
1672
|
it("Finds record invalid - 650 Finnish, with punc", async () => {
|
|
1578
1673
|
const validator = await validatorFactory();
|
|
1579
1674
|
const result = await validator.validate(recordInvalid650FinYes);
|
|
@@ -1586,7 +1681,7 @@ describe("ending-punctuation", () => {
|
|
|
1586
1681
|
const validator = await validatorFactory();
|
|
1587
1682
|
const result = await validator.validate(recordInvalid650EngNoControl);
|
|
1588
1683
|
assert.deepEqual(result, {
|
|
1589
|
-
message: [
|
|
1684
|
+
message: ["Field 650 requires ending punctuation, ends in 's'"],
|
|
1590
1685
|
valid: false
|
|
1591
1686
|
});
|
|
1592
1687
|
});
|
|
@@ -1594,7 +1689,7 @@ describe("ending-punctuation", () => {
|
|
|
1594
1689
|
const validator = await validatorFactory();
|
|
1595
1690
|
const result = await validator.validate(recordInvalid650EngControl);
|
|
1596
1691
|
assert.deepEqual(result, {
|
|
1597
|
-
message: ["Field 650
|
|
1692
|
+
message: ["Field 650 requires ending punctuation, ends in 'n'"],
|
|
1598
1693
|
valid: false
|
|
1599
1694
|
});
|
|
1600
1695
|
});
|
|
@@ -1603,18 +1698,18 @@ describe("ending-punctuation", () => {
|
|
|
1603
1698
|
const result = await validator.fix(recordInvalid647FastEndPunc);
|
|
1604
1699
|
assert.equal(recordInvalid647FastEndPunc.equalsTo(recordValid647FastEndPunc), true);
|
|
1605
1700
|
assert.deepEqual(result, {
|
|
1606
|
-
message: ["Field 647 has
|
|
1607
|
-
fix: ["Field 647 - Removed
|
|
1701
|
+
message: ["Field 647 has an extra dot after ')'"],
|
|
1702
|
+
fix: ["Field 647 - Removed dot after punctuation from $d"],
|
|
1608
1703
|
valid: false
|
|
1609
1704
|
});
|
|
1610
1705
|
});
|
|
1611
1706
|
it("Repairs the invalid record - 648 Finnish, removes punc $a", async () => {
|
|
1612
1707
|
const validator = await validatorFactory();
|
|
1613
|
-
const result = await validator.fix(
|
|
1614
|
-
assert.
|
|
1708
|
+
const result = await validator.fix(recordInvalid648FinYes);
|
|
1709
|
+
assert.deepEqual(recordInvalid648FinYes, recordValid648FinNo);
|
|
1615
1710
|
assert.deepEqual(result, {
|
|
1616
|
-
message: ["Field 648 has
|
|
1617
|
-
fix: ["Field 648 - Removed punctuation from $a"],
|
|
1711
|
+
message: ["Field 648 has unwanted ending punctuation '.'", "Field 648 requires ending punctuation, ends in 'a'"],
|
|
1712
|
+
fix: ["Field 648 - Removed punctuation from $a", "Field 648 - Added punctuation to $a"],
|
|
1618
1713
|
valid: false
|
|
1619
1714
|
});
|
|
1620
1715
|
});
|
|
@@ -1623,7 +1718,7 @@ describe("ending-punctuation", () => {
|
|
|
1623
1718
|
const result = await validator.fix(recordInvalid648FastYes);
|
|
1624
1719
|
assert.equal(recordInvalid648FastYes.equalsTo(recordValid648FastNo), true);
|
|
1625
1720
|
assert.deepEqual(result, {
|
|
1626
|
-
message: ["Field 648 has
|
|
1721
|
+
message: ["Field 648 has unwanted ending punctuation '.'"],
|
|
1627
1722
|
fix: ["Field 648 - Removed punctuation from $a"],
|
|
1628
1723
|
valid: false
|
|
1629
1724
|
});
|
|
@@ -1643,7 +1738,7 @@ describe("ending-punctuation", () => {
|
|
|
1643
1738
|
const result = await validator.fix(recordInvalid650EngNoControl);
|
|
1644
1739
|
assert.equal(recordInvalid650EngNoControl.equalsTo(recordValid650EngNoControl), true);
|
|
1645
1740
|
assert.deepEqual(result, {
|
|
1646
|
-
message: ["Field 650
|
|
1741
|
+
message: ["Field 650 requires ending punctuation, ends in 's'"],
|
|
1647
1742
|
fix: ["Field 650 - Added punctuation to $v"],
|
|
1648
1743
|
valid: false
|
|
1649
1744
|
});
|
|
@@ -1653,13 +1748,13 @@ describe("ending-punctuation", () => {
|
|
|
1653
1748
|
const result = await validator.fix(recordInvalid650EngControl);
|
|
1654
1749
|
assert.equal(recordInvalid650EngControl.equalsTo(recordValid650EngControl), true);
|
|
1655
1750
|
assert.deepEqual(result, {
|
|
1656
|
-
message: ["Field 650
|
|
1751
|
+
message: ["Field 650 requires ending punctuation, ends in 'n'"],
|
|
1657
1752
|
fix: ["Field 650 - Added punctuation to $a"],
|
|
1658
1753
|
valid: false
|
|
1659
1754
|
});
|
|
1660
1755
|
});
|
|
1661
1756
|
});
|
|
1662
|
-
describe("#654-662 TRUE - If
|
|
1757
|
+
describe("#654-662 TRUE - If Finnish, else TRUE", () => {
|
|
1663
1758
|
const recordValid655FinNo = new MarcRecord({
|
|
1664
1759
|
leader: "",
|
|
1665
1760
|
fields: [
|
|
@@ -1930,7 +2025,7 @@ describe("ending-punctuation", () => {
|
|
|
1930
2025
|
const validator = await validatorFactory();
|
|
1931
2026
|
const result = await validator.validate(recordInvalid655FinYes);
|
|
1932
2027
|
assert.deepEqual(result, {
|
|
1933
|
-
message: ["Field 655 has
|
|
2028
|
+
message: ["Field 655 has unwanted ending punctuation '.'"],
|
|
1934
2029
|
valid: false
|
|
1935
2030
|
});
|
|
1936
2031
|
});
|
|
@@ -1938,7 +2033,7 @@ describe("ending-punctuation", () => {
|
|
|
1938
2033
|
const validator = await validatorFactory();
|
|
1939
2034
|
const result = await validator.validate(recordInvalid655FinYes2);
|
|
1940
2035
|
assert.deepEqual(result, {
|
|
1941
|
-
message: ["Field 655 has
|
|
2036
|
+
message: ["Field 655 has unwanted ending punctuation '.'"],
|
|
1942
2037
|
valid: false
|
|
1943
2038
|
});
|
|
1944
2039
|
});
|
|
@@ -1946,7 +2041,7 @@ describe("ending-punctuation", () => {
|
|
|
1946
2041
|
const validator = await validatorFactory();
|
|
1947
2042
|
const result = await validator.validate(recordInvalid655EngNo);
|
|
1948
2043
|
assert.deepEqual(result, {
|
|
1949
|
-
message: ["Field 655
|
|
2044
|
+
message: ["Field 655 requires ending punctuation, ends in '4'"],
|
|
1950
2045
|
valid: false
|
|
1951
2046
|
});
|
|
1952
2047
|
});
|
|
@@ -1954,7 +2049,7 @@ describe("ending-punctuation", () => {
|
|
|
1954
2049
|
const validator = await validatorFactory();
|
|
1955
2050
|
const result = await validator.validate(recordInvalid655EngNoNoControl);
|
|
1956
2051
|
assert.deepEqual(result, {
|
|
1957
|
-
message: ["Field 655
|
|
2052
|
+
message: ["Field 655 requires ending punctuation, ends in 's'"],
|
|
1958
2053
|
valid: false
|
|
1959
2054
|
});
|
|
1960
2055
|
});
|
|
@@ -1962,7 +2057,7 @@ describe("ending-punctuation", () => {
|
|
|
1962
2057
|
const validator = await validatorFactory();
|
|
1963
2058
|
const result = await validator.validate(recordInvalid656FinYes);
|
|
1964
2059
|
assert.deepEqual(result, {
|
|
1965
|
-
message: ["Field 656 has
|
|
2060
|
+
message: ["Field 656 has unwanted ending punctuation '.'"],
|
|
1966
2061
|
valid: false
|
|
1967
2062
|
});
|
|
1968
2063
|
});
|
|
@@ -1970,7 +2065,7 @@ describe("ending-punctuation", () => {
|
|
|
1970
2065
|
const validator = await validatorFactory();
|
|
1971
2066
|
const result = await validator.validate(recordInvalid657EngNo);
|
|
1972
2067
|
assert.deepEqual(result, {
|
|
1973
|
-
message: ["Field 657
|
|
2068
|
+
message: ["Field 657 requires ending punctuation, ends in 'k'"],
|
|
1974
2069
|
valid: false
|
|
1975
2070
|
});
|
|
1976
2071
|
});
|
|
@@ -1978,7 +2073,7 @@ describe("ending-punctuation", () => {
|
|
|
1978
2073
|
const validator = await validatorFactory();
|
|
1979
2074
|
const result = await validator.validate(recordInvalid658EngNo);
|
|
1980
2075
|
assert.deepEqual(result, {
|
|
1981
|
-
message: ["Field 658
|
|
2076
|
+
message: ["Field 658 requires ending punctuation, ends in 'd'"],
|
|
1982
2077
|
valid: false
|
|
1983
2078
|
});
|
|
1984
2079
|
});
|
|
@@ -1986,7 +2081,7 @@ describe("ending-punctuation", () => {
|
|
|
1986
2081
|
const validator = await validatorFactory();
|
|
1987
2082
|
const result = await validator.validate(recordInvalid662EngNo);
|
|
1988
2083
|
assert.deepEqual(result, {
|
|
1989
|
-
message: ["Field 662
|
|
2084
|
+
message: ["Field 662 requires ending punctuation, ends in 'a'"],
|
|
1990
2085
|
valid: false
|
|
1991
2086
|
});
|
|
1992
2087
|
});
|
|
@@ -1995,7 +2090,7 @@ describe("ending-punctuation", () => {
|
|
|
1995
2090
|
const result = await validator.fix(recordInvalid655FinYes);
|
|
1996
2091
|
assert.equal(recordInvalid655FinYes.equalsTo(recordValid655FinNo), true);
|
|
1997
2092
|
assert.deepEqual(result, {
|
|
1998
|
-
message: ["Field 655 has
|
|
2093
|
+
message: ["Field 655 has unwanted ending punctuation '.'"],
|
|
1999
2094
|
fix: ["Field 655 - Removed punctuation from $a"],
|
|
2000
2095
|
valid: false
|
|
2001
2096
|
});
|
|
@@ -2005,7 +2100,7 @@ describe("ending-punctuation", () => {
|
|
|
2005
2100
|
const result = await validator.fix(recordInvalid655FinYes2);
|
|
2006
2101
|
assert.equal(recordInvalid655FinYes2.equalsTo(recordValid655FinNo2), true);
|
|
2007
2102
|
assert.deepEqual(result, {
|
|
2008
|
-
message: ["Field 655 has
|
|
2103
|
+
message: ["Field 655 has unwanted ending punctuation '.'"],
|
|
2009
2104
|
fix: ["Field 655 - Removed punctuation from $a"],
|
|
2010
2105
|
valid: false
|
|
2011
2106
|
});
|
|
@@ -2015,7 +2110,7 @@ describe("ending-punctuation", () => {
|
|
|
2015
2110
|
const result = await validator.fix(recordInvalid655EngNo);
|
|
2016
2111
|
assert.equal(recordInvalid655EngNo.equalsTo(recordValid655EngYes), true);
|
|
2017
2112
|
assert.deepEqual(result, {
|
|
2018
|
-
message: ["Field 655
|
|
2113
|
+
message: ["Field 655 requires ending punctuation, ends in '4'"],
|
|
2019
2114
|
fix: ["Field 655 - Added punctuation to $y"],
|
|
2020
2115
|
valid: false
|
|
2021
2116
|
});
|
|
@@ -2025,7 +2120,7 @@ describe("ending-punctuation", () => {
|
|
|
2025
2120
|
const result = await validator.fix(recordInvalid655EngNoNoControl);
|
|
2026
2121
|
assert.equal(recordInvalid655EngNoNoControl.equalsTo(recordValid655EngYesNoControl), true);
|
|
2027
2122
|
assert.deepEqual(result, {
|
|
2028
|
-
message: ["Field 655
|
|
2123
|
+
message: ["Field 655 requires ending punctuation, ends in 's'"],
|
|
2029
2124
|
fix: ["Field 655 - Added punctuation to $a"],
|
|
2030
2125
|
valid: false
|
|
2031
2126
|
});
|
|
@@ -2035,7 +2130,7 @@ describe("ending-punctuation", () => {
|
|
|
2035
2130
|
const result = await validator.fix(recordInvalid656FinYes);
|
|
2036
2131
|
assert.equal(recordInvalid656FinYes.equalsTo(recordValid656FinNo), true);
|
|
2037
2132
|
assert.deepEqual(result, {
|
|
2038
|
-
message: ["Field 656 has
|
|
2133
|
+
message: ["Field 656 has unwanted ending punctuation '.'"],
|
|
2039
2134
|
fix: ["Field 656 - Removed punctuation from $a"],
|
|
2040
2135
|
valid: false
|
|
2041
2136
|
});
|
|
@@ -2045,7 +2140,7 @@ describe("ending-punctuation", () => {
|
|
|
2045
2140
|
const result = await validator.fix(recordInvalid657EngNo);
|
|
2046
2141
|
assert.equal(recordInvalid657EngNo.equalsTo(recordValid657EngYes), true);
|
|
2047
2142
|
assert.deepEqual(result, {
|
|
2048
|
-
message: ["Field 657
|
|
2143
|
+
message: ["Field 657 requires ending punctuation, ends in 'k'"],
|
|
2049
2144
|
fix: ["Field 657 - Added punctuation to $z"],
|
|
2050
2145
|
valid: false
|
|
2051
2146
|
});
|
|
@@ -2055,17 +2150,17 @@ describe("ending-punctuation", () => {
|
|
|
2055
2150
|
const result = await validator.fix(recordInvalid658EngNo);
|
|
2056
2151
|
assert.equal(recordInvalid658EngNo.equalsTo(recordValid658EngYes), true);
|
|
2057
2152
|
assert.deepEqual(result, {
|
|
2058
|
-
message: ["Field 658
|
|
2153
|
+
message: ["Field 658 requires ending punctuation, ends in 'd'"],
|
|
2059
2154
|
fix: ["Field 658 - Added punctuation to $d"],
|
|
2060
2155
|
valid: false
|
|
2061
2156
|
});
|
|
2062
2157
|
});
|
|
2063
|
-
it("Repairs the invalid record - 662 !Finnish, add
|
|
2158
|
+
it("Repairs the invalid record - 662 !Finnish, add punc $a", async () => {
|
|
2064
2159
|
const validator = await validatorFactory();
|
|
2065
2160
|
const result = await validator.fix(recordInvalid662EngNo);
|
|
2066
2161
|
assert.equal(recordInvalid662EngNo.equalsTo(recordValid662EngYes), true);
|
|
2067
2162
|
assert.deepEqual(result, {
|
|
2068
|
-
message: ["Field 662
|
|
2163
|
+
message: ["Field 662 requires ending punctuation, ends in 'a'"],
|
|
2069
2164
|
fix: ["Field 662 - Added punctuation to $a"],
|
|
2070
2165
|
valid: false
|
|
2071
2166
|
});
|
|
@@ -2138,7 +2233,7 @@ describe("ending-punctuation", () => {
|
|
|
2138
2233
|
const validator = await validatorFactory();
|
|
2139
2234
|
const result = await validator.validate(recordInvalid);
|
|
2140
2235
|
assert.deepEqual(result, {
|
|
2141
|
-
message: ["Field 760 has
|
|
2236
|
+
message: ["Field 760 has unwanted ending punctuation '.'"],
|
|
2142
2237
|
valid: false
|
|
2143
2238
|
});
|
|
2144
2239
|
});
|
|
@@ -2146,7 +2241,7 @@ describe("ending-punctuation", () => {
|
|
|
2146
2241
|
const validator = await validatorFactory();
|
|
2147
2242
|
const result = await validator.validate(recordInvalidOnlyA);
|
|
2148
2243
|
assert.deepEqual(result, {
|
|
2149
|
-
message: ["Field 760
|
|
2244
|
+
message: ["Field 760 requires ending punctuation, ends in 'c'"],
|
|
2150
2245
|
valid: false
|
|
2151
2246
|
});
|
|
2152
2247
|
});
|
|
@@ -2155,7 +2250,7 @@ describe("ending-punctuation", () => {
|
|
|
2155
2250
|
const result = await validator.fix(recordInvalid);
|
|
2156
2251
|
assert.equal(recordInvalid.equalsTo(recordValid), true);
|
|
2157
2252
|
assert.deepEqual(result, {
|
|
2158
|
-
message: ["Field 760 has
|
|
2253
|
+
message: ["Field 760 has unwanted ending punctuation '.'"],
|
|
2159
2254
|
fix: ["Field 760 - Removed punctuation from $e"],
|
|
2160
2255
|
valid: false
|
|
2161
2256
|
});
|
|
@@ -2165,7 +2260,7 @@ describe("ending-punctuation", () => {
|
|
|
2165
2260
|
const result = await validator.fix(recordInvalidOnlyA);
|
|
2166
2261
|
assert.equal(recordInvalidOnlyA.equalsTo(recordValidOnlyA), true);
|
|
2167
2262
|
assert.deepEqual(result, {
|
|
2168
|
-
message: ["Field 760
|
|
2263
|
+
message: ["Field 760 requires ending punctuation, ends in 'c'"],
|
|
2169
2264
|
fix: ["Field 760 - Added punctuation to $a"],
|
|
2170
2265
|
valid: false
|
|
2171
2266
|
});
|
|
@@ -2252,7 +2347,7 @@ describe("ending-punctuation", () => {
|
|
|
2252
2347
|
const validator = await validatorFactory();
|
|
2253
2348
|
const result = await validator.validate(recordInvalidSimple);
|
|
2254
2349
|
assert.deepEqual(result, {
|
|
2255
|
-
message: ["Field 880
|
|
2350
|
+
message: ["Field 880 requires ending punctuation, ends in '3'"],
|
|
2256
2351
|
valid: false
|
|
2257
2352
|
});
|
|
2258
2353
|
});
|
|
@@ -2260,7 +2355,7 @@ describe("ending-punctuation", () => {
|
|
|
2260
2355
|
const validator = await validatorFactory();
|
|
2261
2356
|
const result = await validator.validate(recordInvalidComplex);
|
|
2262
2357
|
assert.deepEqual(result, {
|
|
2263
|
-
message: ["Field 880
|
|
2358
|
+
message: ["Field 880 requires ending punctuation, ends in '6'"],
|
|
2264
2359
|
valid: false
|
|
2265
2360
|
});
|
|
2266
2361
|
});
|
|
@@ -2269,7 +2364,7 @@ describe("ending-punctuation", () => {
|
|
|
2269
2364
|
const result = await validator.fix(recordInvalidSimple);
|
|
2270
2365
|
assert.equal(recordInvalidSimple.equalsTo(recordValidSimple), true);
|
|
2271
2366
|
assert.deepEqual(result, {
|
|
2272
|
-
message: ["Field 880
|
|
2367
|
+
message: ["Field 880 requires ending punctuation, ends in '3'"],
|
|
2273
2368
|
fix: ["Field 880 - Added punctuation to $b"],
|
|
2274
2369
|
valid: false
|
|
2275
2370
|
});
|
|
@@ -2279,7 +2374,7 @@ describe("ending-punctuation", () => {
|
|
|
2279
2374
|
const result = await validator.fix(recordInvalidComplex);
|
|
2280
2375
|
assert.equal(recordInvalidComplex.equalsTo(recordValidComplex), true);
|
|
2281
2376
|
assert.deepEqual(result, {
|
|
2282
|
-
message: ["Field 880
|
|
2377
|
+
message: ["Field 880 requires ending punctuation, ends in '6'"],
|
|
2283
2378
|
fix: ["Field 880 - Added punctuation to $c"],
|
|
2284
2379
|
valid: false
|
|
2285
2380
|
});
|