@natlibfi/marc-record-validators-melinda 12.0.0-alpha.5 → 12.0.0-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 has invalid ending punctuation", "Field 500 has invalid ending punctuation"],
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 has invalid ending punctuation", "Field 500 has invalid ending punctuation"],
123
- fix: ["Field 245 - Added punctuation to $c", "Field 500 - Removed double punctuation from $a"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 invalid ending punctuation", "Field 242 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 invalid ending punctuation", "Field 242 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
572
- fix: ["Field 260 - Removed double punctuation from $g"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
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 has invalid ending punctuation"],
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 invalid ending punctuation"],
1417
+ message: ["Field 567 has unwanted ending punctuation '.'"],
1345
1418
  fix: ["Field 567 - Removed punctuation from $b"],
1346
1419
  valid: false
1347
1420
  });
@@ -1553,7 +1626,7 @@ describe("ending-punctuation", () => {
1553
1626
  const validator = await validatorFactory();
1554
1627
  const result = await validator.validate(recordInvalid647FastEndPunc);
1555
1628
  assert.deepEqual(result, {
1556
- message: ["Field 647 has invalid ending punctuation"],
1629
+ message: ["Field 647 has an extra dot after ')'"],
1557
1630
  valid: false
1558
1631
  });
1559
1632
  });
@@ -1561,7 +1634,7 @@ describe("ending-punctuation", () => {
1561
1634
  const validator = await validatorFactory();
1562
1635
  const result = await validator.validate(recordInvali648dFinYes);
1563
1636
  assert.deepEqual(result, {
1564
- message: ["Field 648 has invalid ending punctuation"],
1637
+ message: ["Field 648 has unwanted ending punctuation '.'"],
1565
1638
  valid: false
1566
1639
  });
1567
1640
  });
@@ -1569,11 +1642,11 @@ describe("ending-punctuation", () => {
1569
1642
  const validator = await validatorFactory();
1570
1643
  const result = await validator.validate(recordInvalid648FastYes);
1571
1644
  assert.deepEqual(result, {
1572
- message: ["Field 648 has invalid ending punctuation"],
1645
+ message: ["Field 648 has unwanted ending punctuation '.'"],
1573
1646
  valid: false
1574
1647
  });
1575
1648
  });
1576
- const invalidField650Message = "Field 650 has invalid ending punctuation";
1649
+ const invalidField650Message = "Field 650 has unwanted ending punctuation '.'";
1577
1650
  it("Finds record invalid - 650 Finnish, with punc", async () => {
1578
1651
  const validator = await validatorFactory();
1579
1652
  const result = await validator.validate(recordInvalid650FinYes);
@@ -1586,7 +1659,7 @@ describe("ending-punctuation", () => {
1586
1659
  const validator = await validatorFactory();
1587
1660
  const result = await validator.validate(recordInvalid650EngNoControl);
1588
1661
  assert.deepEqual(result, {
1589
- message: [invalidField650Message],
1662
+ message: ["Field 650 requires ending punctuation, ends in 's'"],
1590
1663
  valid: false
1591
1664
  });
1592
1665
  });
@@ -1594,7 +1667,7 @@ describe("ending-punctuation", () => {
1594
1667
  const validator = await validatorFactory();
1595
1668
  const result = await validator.validate(recordInvalid650EngControl);
1596
1669
  assert.deepEqual(result, {
1597
- message: ["Field 650 has invalid ending punctuation"],
1670
+ message: ["Field 650 requires ending punctuation, ends in 'n'"],
1598
1671
  valid: false
1599
1672
  });
1600
1673
  });
@@ -1603,8 +1676,8 @@ describe("ending-punctuation", () => {
1603
1676
  const result = await validator.fix(recordInvalid647FastEndPunc);
1604
1677
  assert.equal(recordInvalid647FastEndPunc.equalsTo(recordValid647FastEndPunc), true);
1605
1678
  assert.deepEqual(result, {
1606
- message: ["Field 647 has invalid ending punctuation"],
1607
- fix: ["Field 647 - Removed double punctuation from $d"],
1679
+ message: ["Field 647 has an extra dot after ')'"],
1680
+ fix: ["Field 647 - Removed dot after punctuation from $d"],
1608
1681
  valid: false
1609
1682
  });
1610
1683
  });
@@ -1613,7 +1686,7 @@ describe("ending-punctuation", () => {
1613
1686
  const result = await validator.fix(recordInvali648dFinYes);
1614
1687
  assert.equal(recordInvali648dFinYes.equalsTo(recordVali648dFinNo), true);
1615
1688
  assert.deepEqual(result, {
1616
- message: ["Field 648 has invalid ending punctuation"],
1689
+ message: ["Field 648 has unwanted ending punctuation '.'"],
1617
1690
  fix: ["Field 648 - Removed punctuation from $a"],
1618
1691
  valid: false
1619
1692
  });
@@ -1623,7 +1696,7 @@ describe("ending-punctuation", () => {
1623
1696
  const result = await validator.fix(recordInvalid648FastYes);
1624
1697
  assert.equal(recordInvalid648FastYes.equalsTo(recordValid648FastNo), true);
1625
1698
  assert.deepEqual(result, {
1626
- message: ["Field 648 has invalid ending punctuation"],
1699
+ message: ["Field 648 has unwanted ending punctuation '.'"],
1627
1700
  fix: ["Field 648 - Removed punctuation from $a"],
1628
1701
  valid: false
1629
1702
  });
@@ -1643,7 +1716,7 @@ describe("ending-punctuation", () => {
1643
1716
  const result = await validator.fix(recordInvalid650EngNoControl);
1644
1717
  assert.equal(recordInvalid650EngNoControl.equalsTo(recordValid650EngNoControl), true);
1645
1718
  assert.deepEqual(result, {
1646
- message: ["Field 650 has invalid ending punctuation"],
1719
+ message: ["Field 650 requires ending punctuation, ends in 's'"],
1647
1720
  fix: ["Field 650 - Added punctuation to $v"],
1648
1721
  valid: false
1649
1722
  });
@@ -1653,13 +1726,13 @@ describe("ending-punctuation", () => {
1653
1726
  const result = await validator.fix(recordInvalid650EngControl);
1654
1727
  assert.equal(recordInvalid650EngControl.equalsTo(recordValid650EngControl), true);
1655
1728
  assert.deepEqual(result, {
1656
- message: ["Field 650 has invalid ending punctuation"],
1729
+ message: ["Field 650 requires ending punctuation, ends in 'n'"],
1657
1730
  fix: ["Field 650 - Added punctuation to $a"],
1658
1731
  valid: false
1659
1732
  });
1660
1733
  });
1661
1734
  });
1662
- describe("#654-662 TRUE - If finnish, else TRUE", () => {
1735
+ describe("#654-662 TRUE - If Finnish, else TRUE", () => {
1663
1736
  const recordValid655FinNo = new MarcRecord({
1664
1737
  leader: "",
1665
1738
  fields: [
@@ -1930,7 +2003,7 @@ describe("ending-punctuation", () => {
1930
2003
  const validator = await validatorFactory();
1931
2004
  const result = await validator.validate(recordInvalid655FinYes);
1932
2005
  assert.deepEqual(result, {
1933
- message: ["Field 655 has invalid ending punctuation"],
2006
+ message: ["Field 655 has unwanted ending punctuation '.'"],
1934
2007
  valid: false
1935
2008
  });
1936
2009
  });
@@ -1938,7 +2011,7 @@ describe("ending-punctuation", () => {
1938
2011
  const validator = await validatorFactory();
1939
2012
  const result = await validator.validate(recordInvalid655FinYes2);
1940
2013
  assert.deepEqual(result, {
1941
- message: ["Field 655 has invalid ending punctuation"],
2014
+ message: ["Field 655 has unwanted ending punctuation '.'"],
1942
2015
  valid: false
1943
2016
  });
1944
2017
  });
@@ -1946,7 +2019,7 @@ describe("ending-punctuation", () => {
1946
2019
  const validator = await validatorFactory();
1947
2020
  const result = await validator.validate(recordInvalid655EngNo);
1948
2021
  assert.deepEqual(result, {
1949
- message: ["Field 655 has invalid ending punctuation"],
2022
+ message: ["Field 655 requires ending punctuation, ends in '4'"],
1950
2023
  valid: false
1951
2024
  });
1952
2025
  });
@@ -1954,7 +2027,7 @@ describe("ending-punctuation", () => {
1954
2027
  const validator = await validatorFactory();
1955
2028
  const result = await validator.validate(recordInvalid655EngNoNoControl);
1956
2029
  assert.deepEqual(result, {
1957
- message: ["Field 655 has invalid ending punctuation"],
2030
+ message: ["Field 655 requires ending punctuation, ends in 's'"],
1958
2031
  valid: false
1959
2032
  });
1960
2033
  });
@@ -1962,7 +2035,7 @@ describe("ending-punctuation", () => {
1962
2035
  const validator = await validatorFactory();
1963
2036
  const result = await validator.validate(recordInvalid656FinYes);
1964
2037
  assert.deepEqual(result, {
1965
- message: ["Field 656 has invalid ending punctuation"],
2038
+ message: ["Field 656 has unwanted ending punctuation '.'"],
1966
2039
  valid: false
1967
2040
  });
1968
2041
  });
@@ -1970,7 +2043,7 @@ describe("ending-punctuation", () => {
1970
2043
  const validator = await validatorFactory();
1971
2044
  const result = await validator.validate(recordInvalid657EngNo);
1972
2045
  assert.deepEqual(result, {
1973
- message: ["Field 657 has invalid ending punctuation"],
2046
+ message: ["Field 657 requires ending punctuation, ends in 'k'"],
1974
2047
  valid: false
1975
2048
  });
1976
2049
  });
@@ -1978,7 +2051,7 @@ describe("ending-punctuation", () => {
1978
2051
  const validator = await validatorFactory();
1979
2052
  const result = await validator.validate(recordInvalid658EngNo);
1980
2053
  assert.deepEqual(result, {
1981
- message: ["Field 658 has invalid ending punctuation"],
2054
+ message: ["Field 658 requires ending punctuation, ends in 'd'"],
1982
2055
  valid: false
1983
2056
  });
1984
2057
  });
@@ -1986,7 +2059,7 @@ describe("ending-punctuation", () => {
1986
2059
  const validator = await validatorFactory();
1987
2060
  const result = await validator.validate(recordInvalid662EngNo);
1988
2061
  assert.deepEqual(result, {
1989
- message: ["Field 662 has invalid ending punctuation"],
2062
+ message: ["Field 662 requires ending punctuation, ends in 'a'"],
1990
2063
  valid: false
1991
2064
  });
1992
2065
  });
@@ -1995,7 +2068,7 @@ describe("ending-punctuation", () => {
1995
2068
  const result = await validator.fix(recordInvalid655FinYes);
1996
2069
  assert.equal(recordInvalid655FinYes.equalsTo(recordValid655FinNo), true);
1997
2070
  assert.deepEqual(result, {
1998
- message: ["Field 655 has invalid ending punctuation"],
2071
+ message: ["Field 655 has unwanted ending punctuation '.'"],
1999
2072
  fix: ["Field 655 - Removed punctuation from $a"],
2000
2073
  valid: false
2001
2074
  });
@@ -2005,7 +2078,7 @@ describe("ending-punctuation", () => {
2005
2078
  const result = await validator.fix(recordInvalid655FinYes2);
2006
2079
  assert.equal(recordInvalid655FinYes2.equalsTo(recordValid655FinNo2), true);
2007
2080
  assert.deepEqual(result, {
2008
- message: ["Field 655 has invalid ending punctuation"],
2081
+ message: ["Field 655 has unwanted ending punctuation '.'"],
2009
2082
  fix: ["Field 655 - Removed punctuation from $a"],
2010
2083
  valid: false
2011
2084
  });
@@ -2015,7 +2088,7 @@ describe("ending-punctuation", () => {
2015
2088
  const result = await validator.fix(recordInvalid655EngNo);
2016
2089
  assert.equal(recordInvalid655EngNo.equalsTo(recordValid655EngYes), true);
2017
2090
  assert.deepEqual(result, {
2018
- message: ["Field 655 has invalid ending punctuation"],
2091
+ message: ["Field 655 requires ending punctuation, ends in '4'"],
2019
2092
  fix: ["Field 655 - Added punctuation to $y"],
2020
2093
  valid: false
2021
2094
  });
@@ -2025,7 +2098,7 @@ describe("ending-punctuation", () => {
2025
2098
  const result = await validator.fix(recordInvalid655EngNoNoControl);
2026
2099
  assert.equal(recordInvalid655EngNoNoControl.equalsTo(recordValid655EngYesNoControl), true);
2027
2100
  assert.deepEqual(result, {
2028
- message: ["Field 655 has invalid ending punctuation"],
2101
+ message: ["Field 655 requires ending punctuation, ends in 's'"],
2029
2102
  fix: ["Field 655 - Added punctuation to $a"],
2030
2103
  valid: false
2031
2104
  });
@@ -2035,7 +2108,7 @@ describe("ending-punctuation", () => {
2035
2108
  const result = await validator.fix(recordInvalid656FinYes);
2036
2109
  assert.equal(recordInvalid656FinYes.equalsTo(recordValid656FinNo), true);
2037
2110
  assert.deepEqual(result, {
2038
- message: ["Field 656 has invalid ending punctuation"],
2111
+ message: ["Field 656 has unwanted ending punctuation '.'"],
2039
2112
  fix: ["Field 656 - Removed punctuation from $a"],
2040
2113
  valid: false
2041
2114
  });
@@ -2045,7 +2118,7 @@ describe("ending-punctuation", () => {
2045
2118
  const result = await validator.fix(recordInvalid657EngNo);
2046
2119
  assert.equal(recordInvalid657EngNo.equalsTo(recordValid657EngYes), true);
2047
2120
  assert.deepEqual(result, {
2048
- message: ["Field 657 has invalid ending punctuation"],
2121
+ message: ["Field 657 requires ending punctuation, ends in 'k'"],
2049
2122
  fix: ["Field 657 - Added punctuation to $z"],
2050
2123
  valid: false
2051
2124
  });
@@ -2055,17 +2128,17 @@ describe("ending-punctuation", () => {
2055
2128
  const result = await validator.fix(recordInvalid658EngNo);
2056
2129
  assert.equal(recordInvalid658EngNo.equalsTo(recordValid658EngYes), true);
2057
2130
  assert.deepEqual(result, {
2058
- message: ["Field 658 has invalid ending punctuation"],
2131
+ message: ["Field 658 requires ending punctuation, ends in 'd'"],
2059
2132
  fix: ["Field 658 - Added punctuation to $d"],
2060
2133
  valid: false
2061
2134
  });
2062
2135
  });
2063
- it("Repairs the invalid record - 662 !Finnish, add pun $a", async () => {
2136
+ it("Repairs the invalid record - 662 !Finnish, add punc $a", async () => {
2064
2137
  const validator = await validatorFactory();
2065
2138
  const result = await validator.fix(recordInvalid662EngNo);
2066
2139
  assert.equal(recordInvalid662EngNo.equalsTo(recordValid662EngYes), true);
2067
2140
  assert.deepEqual(result, {
2068
- message: ["Field 662 has invalid ending punctuation"],
2141
+ message: ["Field 662 requires ending punctuation, ends in 'a'"],
2069
2142
  fix: ["Field 662 - Added punctuation to $a"],
2070
2143
  valid: false
2071
2144
  });
@@ -2138,7 +2211,7 @@ describe("ending-punctuation", () => {
2138
2211
  const validator = await validatorFactory();
2139
2212
  const result = await validator.validate(recordInvalid);
2140
2213
  assert.deepEqual(result, {
2141
- message: ["Field 760 has invalid ending punctuation"],
2214
+ message: ["Field 760 has unwanted ending punctuation '.'"],
2142
2215
  valid: false
2143
2216
  });
2144
2217
  });
@@ -2146,7 +2219,7 @@ describe("ending-punctuation", () => {
2146
2219
  const validator = await validatorFactory();
2147
2220
  const result = await validator.validate(recordInvalidOnlyA);
2148
2221
  assert.deepEqual(result, {
2149
- message: ["Field 760 has invalid ending punctuation"],
2222
+ message: ["Field 760 requires ending punctuation, ends in 'c'"],
2150
2223
  valid: false
2151
2224
  });
2152
2225
  });
@@ -2155,7 +2228,7 @@ describe("ending-punctuation", () => {
2155
2228
  const result = await validator.fix(recordInvalid);
2156
2229
  assert.equal(recordInvalid.equalsTo(recordValid), true);
2157
2230
  assert.deepEqual(result, {
2158
- message: ["Field 760 has invalid ending punctuation"],
2231
+ message: ["Field 760 has unwanted ending punctuation '.'"],
2159
2232
  fix: ["Field 760 - Removed punctuation from $e"],
2160
2233
  valid: false
2161
2234
  });
@@ -2165,7 +2238,7 @@ describe("ending-punctuation", () => {
2165
2238
  const result = await validator.fix(recordInvalidOnlyA);
2166
2239
  assert.equal(recordInvalidOnlyA.equalsTo(recordValidOnlyA), true);
2167
2240
  assert.deepEqual(result, {
2168
- message: ["Field 760 has invalid ending punctuation"],
2241
+ message: ["Field 760 requires ending punctuation, ends in 'c'"],
2169
2242
  fix: ["Field 760 - Added punctuation to $a"],
2170
2243
  valid: false
2171
2244
  });
@@ -2252,7 +2325,7 @@ describe("ending-punctuation", () => {
2252
2325
  const validator = await validatorFactory();
2253
2326
  const result = await validator.validate(recordInvalidSimple);
2254
2327
  assert.deepEqual(result, {
2255
- message: ["Field 880 has invalid ending punctuation"],
2328
+ message: ["Field 880 requires ending punctuation, ends in '3'"],
2256
2329
  valid: false
2257
2330
  });
2258
2331
  });
@@ -2260,7 +2333,7 @@ describe("ending-punctuation", () => {
2260
2333
  const validator = await validatorFactory();
2261
2334
  const result = await validator.validate(recordInvalidComplex);
2262
2335
  assert.deepEqual(result, {
2263
- message: ["Field 880 has invalid ending punctuation"],
2336
+ message: ["Field 880 requires ending punctuation, ends in '6'"],
2264
2337
  valid: false
2265
2338
  });
2266
2339
  });
@@ -2269,7 +2342,7 @@ describe("ending-punctuation", () => {
2269
2342
  const result = await validator.fix(recordInvalidSimple);
2270
2343
  assert.equal(recordInvalidSimple.equalsTo(recordValidSimple), true);
2271
2344
  assert.deepEqual(result, {
2272
- message: ["Field 880 has invalid ending punctuation"],
2345
+ message: ["Field 880 requires ending punctuation, ends in '3'"],
2273
2346
  fix: ["Field 880 - Added punctuation to $b"],
2274
2347
  valid: false
2275
2348
  });
@@ -2279,7 +2352,7 @@ describe("ending-punctuation", () => {
2279
2352
  const result = await validator.fix(recordInvalidComplex);
2280
2353
  assert.equal(recordInvalidComplex.equalsTo(recordValidComplex), true);
2281
2354
  assert.deepEqual(result, {
2282
- message: ["Field 880 has invalid ending punctuation"],
2355
+ message: ["Field 880 requires ending punctuation, ends in '6'"],
2283
2356
  fix: ["Field 880 - Added punctuation to $c"],
2284
2357
  valid: false
2285
2358
  });