proskomma-core 0.9.12 → 0.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/esm/wrapper.mjs +1 -1
  2. package/{index.js → index.cjs} +1 -1
  3. package/package.json +2 -2
  4. package/babel.config.js +0 -18
  5. package/test/code/main/bad.cjs +0 -79
  6. package/test/code/main/basics.cjs +0 -534
  7. package/test/code/main/block.cjs +0 -586
  8. package/test/code/main/block_scope_numbers.cjs +0 -31
  9. package/test/code/main/blocks_with_atts.cjs +0 -150
  10. package/test/code/main/blocks_with_cv.cjs +0 -250
  11. package/test/code/main/break.cjs +0 -73
  12. package/test/code/main/checksum.cjs +0 -36
  13. package/test/code/main/cl_global.cjs +0 -35
  14. package/test/code/main/class_for_fragment.cjs +0 -18
  15. package/test/code/main/clean_usfm.cjs +0 -46
  16. package/test/code/main/cp_vp.cjs +0 -158
  17. package/test/code/main/custom.cjs +0 -124
  18. package/test/code/main/cv.cjs +0 -249
  19. package/test/code/main/cvMatching.cjs +0 -155
  20. package/test/code/main/cv_indexes.cjs +0 -189
  21. package/test/code/main/cv_navigation.cjs +0 -124
  22. package/test/code/main/document.cjs +0 -382
  23. package/test/code/main/empty_blocks.cjs +0 -71
  24. package/test/code/main/entries.cjs +0 -402
  25. package/test/code/main/export_lexing_regexes.cjs +0 -19
  26. package/test/code/main/fig.cjs +0 -67
  27. package/test/code/main/filter.cjs +0 -222
  28. package/test/code/main/glossary.cjs +0 -36
  29. package/test/code/main/graft_headings.cjs +0 -36
  30. package/test/code/main/graft_introduction.cjs +0 -96
  31. package/test/code/main/graft_note.cjs +0 -104
  32. package/test/code/main/graft_rems.cjs +0 -34
  33. package/test/code/main/graft_sidebars.cjs +0 -62
  34. package/test/code/main/graft_title.cjs +0 -36
  35. package/test/code/main/hello.cjs +0 -105
  36. package/test/code/main/import_document.cjs +0 -22
  37. package/test/code/main/import_usfm_int.cjs +0 -48
  38. package/test/code/main/item_groups.cjs +0 -133
  39. package/test/code/main/items_with_cv.cjs +0 -311
  40. package/test/code/main/milestone_attributes.cjs +0 -163
  41. package/test/code/main/mixed_sequence_documents.cjs +0 -137
  42. package/test/code/main/mixed_sequences.cjs +0 -217
  43. package/test/code/main/modify_sequence.cjs +0 -29
  44. package/test/code/main/multiple_chapters.cjs +0 -58
  45. package/test/code/main/multiple_content.cjs +0 -105
  46. package/test/code/main/mutate_add.cjs +0 -180
  47. package/test/code/main/mutate_delete.cjs +0 -236
  48. package/test/code/main/mutate_rehash.cjs +0 -68
  49. package/test/code/main/mutate_tags.cjs +0 -90
  50. package/test/code/main/mutate_update.cjs +0 -538
  51. package/test/code/main/selectors.cjs +0 -289
  52. package/test/code/main/sequence.cjs +0 -361
  53. package/test/code/main/serialize.cjs +0 -104
  54. package/test/code/main/spans.cjs +0 -51
  55. package/test/code/main/split_long_tokens.cjs +0 -30
  56. package/test/code/main/standard_vrs.cjs +0 -76
  57. package/test/code/main/subclass.cjs +0 -25
  58. package/test/code/main/table.cjs +0 -119
  59. package/test/code/main/tags.cjs +0 -248
  60. package/test/code/main/token_alignment.cjs +0 -84
  61. package/test/code/main/trees.cjs +0 -211
  62. package/test/code/main/tribos.cjs +0 -865
  63. package/test/code/main/tsv.cjs +0 -385
  64. package/test/code/main/usx_ref.cjs +0 -65
  65. package/test/code/main/verse_mapping.cjs +0 -252
  66. package/test/code/main/verse_range.cjs +0 -31
  67. package/test/code/main/word_likes.cjs +0 -41
  68. package/test/code/utils/byte_array.cjs +0 -271
  69. package/test/code/utils/canons.cjs +0 -20
  70. package/test/code/utils/generate_id.cjs +0 -17
  71. package/test/code/utils/graft_defs.cjs +0 -16
  72. package/test/code/utils/inspect.cjs +0 -130
  73. package/test/code/utils/items.cjs +0 -56
  74. package/test/code/utils/push_succinct.cjs +0 -69
  75. package/test/code/utils/scope_defs.cjs +0 -79
  76. package/test/code/utils/serialize.cjs +0 -28
  77. package/test/code/utils/splice.cjs +0 -67
  78. package/test/code/utils/tags.cjs +0 -69
  79. package/test/code/utils/versification.cjs +0 -249
  80. package/test/lib/load.js +0 -110
  81. package/test/skipped_code/diff.js +0 -53
  82. package/test/test_data/inputBlockSpec/dodson.json +0 -1654
  83. package/test/test_data/inputBlockSpec/kv.json +0 -326
  84. package/test/test_data/inputBlockSpec/mk1.json +0 -1019
  85. package/test/test_data/inputBlockSpec/table.json +0 -170
  86. package/test/test_data/tree/genealogy.json +0 -55
  87. package/test/test_data/tree/jude.json +0 -15965
  88. package/test/test_data/tsv/en_tn_66-JUD.tsv +0 -75
  89. package/test/test_data/tsv/twl_JUD.tsv +0 -144
  90. package/test/test_data/usfm/1pe_webbe.usfm +0 -13
  91. package/test/test_data/usfm/66-JUD-ust.usfm +0 -1089
  92. package/test/test_data/usfm/78-GALspavbl.usfm +0 -10
  93. package/test/test_data/usfm/add_test.usfm +0 -15
  94. package/test/test_data/usfm/backslash.usfm +0 -4
  95. package/test/test_data/usfm/cl.usfm +0 -14
  96. package/test/test_data/usfm/cp_vp.usfm +0 -8
  97. package/test/test_data/usfm/custom.usfm +0 -13
  98. package/test/test_data/usfm/en_ust_oba.usfm +0 -875
  99. package/test/test_data/usfm/en_ust_psa_1.usfm +0 -20
  100. package/test/test_data/usfm/fig.usfm +0 -3
  101. package/test/test_data/usfm/filter.usfm +0 -7
  102. package/test/test_data/usfm/footnote.usfm +0 -11
  103. package/test/test_data/usfm/frt.usfm +0 -4
  104. package/test/test_data/usfm/headings.usfm +0 -7
  105. package/test/test_data/usfm/hello.usfm +0 -8
  106. package/test/test_data/usfm/int.usfm +0 -7
  107. package/test/test_data/usfm/milestone_attributes.usfm +0 -7
  108. package/test/test_data/usfm/milestone_attributes_default.usfm +0 -7
  109. package/test/test_data/usfm/no_break_space.usfm +0 -4
  110. package/test/test_data/usfm/no_mt.usfm +0 -6
  111. package/test/test_data/usfm/rems.usfm +0 -6
  112. package/test/test_data/usfm/section_intros.usfm +0 -26
  113. package/test/test_data/usfm/sidebars.usfm +0 -25
  114. package/test/test_data/usfm/slash_in_att.usfm +0 -6
  115. package/test/test_data/usfm/soft_line_break.usfm +0 -4
  116. package/test/test_data/usfm/spans.usfm +0 -5
  117. package/test/test_data/usfm/split_long_tokens.usfm +0 -6
  118. package/test/test_data/usfm/table.usfm +0 -18
  119. package/test/test_data/usfm/table_at_end.usfm +0 -11
  120. package/test/test_data/usfm/table_in_intro.usfm +0 -22
  121. package/test/test_data/usfm/table_no_end_cells.usfm +0 -18
  122. package/test/test_data/usfm/tit_kitchen_sink.usfm +0 -73
  123. package/test/test_data/usfm/titus_template.usfm +0 -58
  124. package/test/test_data/usfm/ugnt_3jn.usfm +0 -265
  125. package/test/test_data/usfm/ult_3jn.usfm +0 -335
  126. package/test/test_data/usfm/unknown.usfm +0 -5
  127. package/test/test_data/usfm/ust_psa.usfm +0 -29
  128. package/test/test_data/usfm/ust_psa_verse_ranges.usfm +0 -24
  129. package/test/test_data/usfm/ust_psa_with_ts.usfm +0 -29
  130. package/test/test_data/usfm/verse_breaks_in_blocks.usfm +0 -20
  131. package/test/test_data/usfm/verse_range.usfm +0 -7
  132. package/test/test_data/usfm/web_ecc.usfm +0 -391
  133. package/test/test_data/usfm/web_psa51.usfm +0 -71
  134. package/test/test_data/usfm/whitespace.usfm +0 -12
  135. package/test/test_data/usfm/xref.usfm +0 -11
  136. package/test/test_data/usx/bad_element.usx +0 -2
  137. package/test/test_data/usx/cp_vp.usx +0 -12
  138. package/test/test_data/usx/diff1.usx +0 -59
  139. package/test/test_data/usx/diff2.usx +0 -74
  140. package/test/test_data/usx/douay_rheims_ecc.usx +0 -58
  141. package/test/test_data/usx/douay_rheims_psa.usx +0 -5366
  142. package/test/test_data/usx/douay_rheims_psa_40_60.usx +0 -666
  143. package/test/test_data/usx/douay_rheims_rut.usx +0 -26
  144. package/test/test_data/usx/esg3.usx +0 -47
  145. package/test/test_data/usx/fig.usx +0 -6
  146. package/test/test_data/usx/milestone_attributes.usx +0 -11
  147. package/test/test_data/usx/not_nfc18_glo.usx +0 -9
  148. package/test/test_data/usx/not_nfc18_phm.usx +0 -24
  149. package/test/test_data/usx/opt_break.usx +0 -10
  150. package/test/test_data/usx/sidebars.usx +0 -29
  151. package/test/test_data/usx/table.usx +0 -23
  152. package/test/test_data/usx/web_psa.usx +0 -8489
  153. package/test/test_data/usx/web_psa150.usx +0 -33
  154. package/test/test_data/usx/web_psa_40_60.usx +0 -1079
  155. package/test/test_data/usx/web_rut.usx +0 -95
  156. package/test/test_data/usx/web_rut_1.usx +0 -17
  157. package/test/test_data/utils/douay_rheims.vrs +0 -520
  158. package/test/test_data/utils/douay_rheims_PSA.usx +0 -5366
  159. package/test/test_data/utils/serialize_example.json +0 -91
  160. package/test/test_data/utils/truncated_versification.vrs +0 -29
  161. package/test/test_data/utils/web_rut_items.json +0 -2977
  162. package/test/test_data/utils/webbe.vrs +0 -395
  163. package/test/test_data/utils/webbe_PSA.usx +0 -8489
  164. package/test/test_data/vrs/douay_rheims.vrs +0 -520
  165. package/test/test_data/vrs/truncated_versification.vrs +0 -27
  166. package/test/test_data/vrs/webbe.vrs +0 -397
  167. package/webpack.prod.js +0 -50
@@ -1,150 +0,0 @@
1
- const test = require('tape');
2
-
3
- const { pkWithDoc } = require('../../lib/load.js');
4
-
5
- const testGroup = 'Blocks with Atts';
6
-
7
- const pk = pkWithDoc('../test_data/usfm/1pe_webbe.usfm', {
8
- lang: 'eng',
9
- abbr: 'hello',
10
- })[0];
11
-
12
- test(
13
- `attSpecs + !attValues (${testGroup})`,
14
- async function (t) {
15
- try {
16
- t.plan(2);
17
- const query =
18
- '{ docSets { document(bookCode:"1PE") {' +
19
- ' mainSequence {' +
20
- ' blocks(' +
21
- ' attSpecs: [[{attType:"spanWithAtts", tagName:"w", attKey:"strongs", valueN:0}]]' +
22
- ' ) {' +
23
- ' cBL' +
24
- ' }' +
25
- ' }' +
26
- ' }' +
27
- ' }' +
28
- '}';
29
- const result = await pk.gqlQuery(query);
30
- t.equal(result.errors.length, 1);
31
- t.ok(result.errors[0].message.includes('Cannot specify attSpecs without attValues'));
32
- } catch (err) {
33
- console.log(err);
34
- }
35
- },
36
- );
37
-
38
- test(
39
- `!attSpecs + attValues (${testGroup})`,
40
- async function (t) {
41
- try {
42
- t.plan(2);
43
- const query =
44
- '{ docSets { document(bookCode:"1PE") {' +
45
- ' mainSequence {' +
46
- ' blocks(' +
47
- ' attValues:[["H5662"]]' +
48
- ' ) {' +
49
- ' cBL' +
50
- ' }' +
51
- ' }' +
52
- ' }' +
53
- ' }' +
54
- '}';
55
- const result = await pk.gqlQuery(query);
56
- t.equal(result.errors.length, 1);
57
- t.ok(result.errors[0].message.includes('Cannot specify attValues without attSpecs'));
58
- } catch (err) {
59
- console.log(err);
60
- }
61
- },
62
- );
63
-
64
- test(
65
- `Filter by att (${testGroup})`,
66
- async function (t) {
67
- try {
68
- t.plan(2);
69
- const query =
70
- '{ docSets { document(bookCode:"1PE") {' +
71
- ' mainSequence {' +
72
- ' blocks(' +
73
- ' attSpecs: [[{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]]' +
74
- ' attValues:[["G2587"]]' +
75
- ' ) {' +
76
- ' cBL' +
77
- ' }' +
78
- ' }' +
79
- ' }' +
80
- ' }' +
81
- '}';
82
- const result = await pk.gqlQuery(query);
83
- t.equal(result.errors, undefined);
84
- t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 1);
85
- } catch (err) {
86
- console.log(err);
87
- }
88
- },
89
- );
90
-
91
- test(
92
- `Any matching att (${testGroup})`,
93
- async function (t) {
94
- try {
95
- t.plan(2);
96
- const query =
97
- '{ docSets { document(bookCode:"1PE") {' +
98
- ' mainSequence {' +
99
- ' blocks(' +
100
- ' attSpecs: [' +
101
- ' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}],' +
102
- ' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]' +
103
- ' ]' +
104
- ' attValues:[["G2587"], ["G2962"]]' +
105
- ' ) {' +
106
- ' cBL' +
107
- ' }' +
108
- ' }' +
109
- ' }' +
110
- ' }' +
111
- '}';
112
- const result = await pk.gqlQuery(query);
113
- t.equal(result.errors, undefined);
114
- t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 2);
115
- } catch (err) {
116
- console.log(err);
117
- }
118
- },
119
- );
120
-
121
- test(
122
- `All matching atts (${testGroup})`,
123
- async function (t) {
124
- try {
125
- t.plan(2);
126
- const query =
127
- '{ docSets { document(bookCode:"1PE") {' +
128
- ' mainSequence {' +
129
- ' blocks(' +
130
- ' attSpecs: [' +
131
- ' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}],' +
132
- ' [{attType:"spanWithAtts", tagName:"w", attKey:"strong", valueN:0}]' +
133
- ' ]' +
134
- ' attValues:[["G2532", "G9999"], ["G1519", "G0000"]]' +
135
- ' allAtts:true' +
136
- ' ) {' +
137
- ' cBL' +
138
- ' }' +
139
- ' }' +
140
- ' }' +
141
- ' }' +
142
- '}';
143
- const result = await pk.gqlQuery(query);
144
- t.equal(result.errors, undefined);
145
- t.equal(result.data.docSets[0].document.mainSequence.blocks.length, 1);
146
- } catch (err) {
147
- console.log(err);
148
- }
149
- },
150
- );
@@ -1,250 +0,0 @@
1
- const test = require('tape');
2
-
3
- const { pkWithDoc } = require('../../lib/load.js');
4
-
5
- const testGroup = 'Blocks with CV';
6
-
7
- const pk = pkWithDoc('../test_data/usx/web_rut.usx', {
8
- lang: 'fra',
9
- abbr: 'hello',
10
- })[0];
11
-
12
- const pk2 = pkWithDoc('../test_data/usx/web_psa_40_60.usx', {
13
- lang: 'eng',
14
- abbr: 'web',
15
- })[0];
16
-
17
- test(
18
- `Bad bookScope (${testGroup})`,
19
- async function (t) {
20
- try {
21
- t.plan(2);
22
- const query =
23
- '{ docSets { document(bookCode:"RUT") {' +
24
- ' mainSequence { blocks(withScriptureCV:2) { cBL } } } }' +
25
- '}';
26
- const result = await pk.gqlQuery(query);
27
- t.equal(result.errors.length, 1);
28
- t.equal(result.errors.filter(e => e.message.includes('cannot represent a non string value: 2')).length, 1);
29
- } catch (err) {
30
- console.log(err);
31
- }
32
- },
33
- );
34
-
35
- test(
36
- `bookScope + withScopes (${testGroup})`,
37
- async function (t) {
38
- try {
39
- t.plan(2);
40
- const query =
41
- '{ docSets { document(bookCode:"RUT") {' +
42
- ' mainSequence { blocks(withScriptureCV:"2" withScopes:[]) { cBL } } } }' +
43
- '}';
44
- const result = await pk.gqlQuery(query);
45
- t.equal(result.errors.length, 1);
46
- t.ok(result.errors[0].message.includes('Cannot specify both withScopes and withScriptureCV'));
47
- } catch (err) {
48
- console.log(err);
49
- }
50
- },
51
- );
52
-
53
- test(
54
- `One chapter (${testGroup})`,
55
- async function (t) {
56
- try {
57
- t.plan(3);
58
- const query =
59
- '{ docSets { document(bookCode:"RUT") {' +
60
- ' mainSequence { blocks(withScriptureCV:"2") { text } } } }' +
61
- '}';
62
- const result = await pk.gqlQuery(query);
63
- t.equal(result.errors, undefined);
64
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
65
- t.ok(blocks[0].text.startsWith('Naomi had a relative of her husband'));
66
- t.ok(blocks[blocks.length - 1].text.endsWith('lived with her mother-in-law.'));
67
- } catch (err) {
68
- console.log(err);
69
- }
70
- },
71
- );
72
-
73
- test(
74
- `Chapter range (${testGroup})`,
75
- async function (t) {
76
- try {
77
- t.plan(3);
78
- const query =
79
- '{ docSets { document(bookCode:"RUT") {' +
80
- ' mainSequence { blocks(withScriptureCV:"1-3") { text } } } }' +
81
- '}';
82
- const result = await pk.gqlQuery(query);
83
- t.equal(result.errors, undefined);
84
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
85
- t.ok(blocks[0].text.startsWith('In the days when the judges judged'));
86
- t.ok(blocks[blocks.length - 1].text.endsWith('until he has settled this today.”'));
87
- } catch (err) {
88
- console.log(err);
89
- }
90
- },
91
- );
92
-
93
- test(
94
- `Reverse chapter range (${testGroup})`,
95
- async function (t) {
96
- try {
97
- t.plan(2);
98
- const query =
99
- '{ docSets { document(bookCode:"RUT") {' +
100
- ' mainSequence { blocks(withScriptureCV:"3-1") { text } } } }' +
101
- '}';
102
- const result = await pk.gqlQuery(query);
103
- t.equal(result.errors.length, 1);
104
- t.ok(result.errors[0].message.includes('Chapter range must be from min to max'));
105
- } catch (err) {
106
- console.log(err);
107
- }
108
- },
109
- );
110
-
111
- test(
112
- `One verse (${testGroup})`,
113
- async function (t) {
114
- try {
115
- t.plan(3);
116
- const query =
117
- '{ docSets { document(bookCode:"RUT") {' +
118
- ' mainSequence { blocks(withScriptureCV:"1:14") { text } } } }' +
119
- '}';
120
- const result = await pk.gqlQuery(query);
121
- t.equal(result.errors, undefined);
122
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
123
- t.ok(blocks[0].text.startsWith('They lifted up their voices'));
124
- t.ok(blocks[blocks.length - 1].text.endsWith('Follow your sister-in-law.”'));
125
- } catch (err) {
126
- console.log(err);
127
- }
128
- },
129
- );
130
-
131
- test(
132
- `Verse zero (${testGroup})`,
133
- async function (t) {
134
- try {
135
- t.plan(3);
136
- const query =
137
- '{ docSets { document(bookCode:"PSA") {' +
138
- ' mainSequence { blocks(withScriptureCV:"51:0") { text } } } }' +
139
- '}';
140
- const result = await pk2.gqlQuery(query);
141
- t.equal(result.errors, undefined);
142
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
143
- t.ok(blocks[0].text.startsWith('For the Chief'));
144
- t.ok(blocks[blocks.length - 1].text.endsWith('Bathsheba.'));
145
- } catch (err) {
146
- console.log(err);
147
- }
148
- },
149
- );
150
-
151
- test(
152
- `Verse range (${testGroup})`,
153
- async function (t) {
154
- try {
155
- t.plan(3);
156
- const query =
157
- '{ docSets { document(bookCode:"RUT") {' +
158
- ' mainSequence { blocks(withScriptureCV:"1:10-13") { text } } } }' +
159
- '}';
160
- const result = await pk.gqlQuery(query);
161
- t.equal(result.errors, undefined);
162
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
163
- t.ok(blocks[0].text.startsWith('Then she kissed them'));
164
- t.ok(blocks[blocks.length - 1].text.endsWith('hand has gone out against me.”'));
165
- } catch (err) {
166
- console.log(err);
167
- }
168
- },
169
- );
170
-
171
- test(
172
- `Verse range from zero (${testGroup})`,
173
- async function (t) {
174
- try {
175
- t.plan(3);
176
- const query =
177
- '{ docSets { document(bookCode:"PSA") {' +
178
- ' mainSequence { blocks(withScriptureCV:"51:0-1") { text } } } }' +
179
- '}';
180
- const result = await pk2.gqlQuery(query);
181
- t.equal(result.errors, undefined);
182
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
183
- t.ok(blocks[0].text.startsWith('For the Chief'));
184
- t.ok(blocks[blocks.length - 1].text.endsWith('transgressions.'));
185
- } catch (err) {
186
- console.log(err);
187
- }
188
- },
189
- );
190
-
191
- test(
192
- `Chapter/verse range (${testGroup})`,
193
- async function (t) {
194
- try {
195
- t.plan(3);
196
- const query =
197
- '{ docSets { document(bookCode:"RUT") {' +
198
- ' mainSequence { blocks(withScriptureCV:"1:22-3:4") { text } } } }' +
199
- '}';
200
- const result = await pk.gqlQuery(query);
201
- t.equal(result.errors, undefined);
202
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
203
- t.ok(blocks[0].text.startsWith('She said to them,'));
204
- t.ok(blocks[blocks.length - 1].text.endsWith('Then he will tell you what to do.”'));
205
- } catch (err) {
206
- console.log(err);
207
- }
208
- },
209
- );
210
-
211
- test(
212
- `Chapter/verse range to verse 0 (${testGroup})`,
213
- async function (t) {
214
- try {
215
- t.plan(3);
216
- const query =
217
- '{ docSets { document(bookCode:"PSA") {' +
218
- ' mainSequence { blocks(withScriptureCV:"50:23-51:0") { text } } } }' +
219
- '}';
220
- const result = await pk2.gqlQuery(query);
221
- t.equal(result.errors, undefined);
222
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
223
- t.ok(blocks[0].text.startsWith('Whoever offers'));
224
- t.ok(blocks[blocks.length - 1].text.endsWith('Bathsheba.'));
225
- } catch (err) {
226
- console.log(err);
227
- }
228
- },
229
- );
230
-
231
- test(
232
- `Chapter/verse range from verse 0 (${testGroup})`,
233
- async function (t) {
234
- try {
235
- t.plan(3);
236
- const query =
237
- '{ docSets { document(bookCode:"PSA") {' +
238
- ' mainSequence { blocks(withScriptureCV:"51:0-52:1") { text } } } }' +
239
- '}';
240
- const result = await pk2.gqlQuery(query);
241
- t.equal(result.errors, undefined);
242
- const blocks = result.data.docSets[0].document.mainSequence.blocks;
243
- t.ok(blocks[0].text.startsWith('For the Chief'));
244
- t.ok(blocks[blocks.length - 1].text.endsWith('continually.'));
245
- } catch (err) {
246
- console.log(err);
247
- }
248
- },
249
- );
250
-
@@ -1,73 +0,0 @@
1
- const test = require('tape');
2
-
3
- const { pkWithDoc } = require('../../lib/load.js');
4
-
5
- const testGroup = 'Lexing Breaks';
6
-
7
- const pk = pkWithDoc('../test_data/usfm/no_break_space.usfm', {
8
- lang: 'fra',
9
- abbr: 'hello',
10
- })[0];
11
- const pk2 = pkWithDoc('../test_data/usfm/soft_line_break.usfm', {
12
- lang: 'fra',
13
- abbr: 'hello',
14
- })[0];
15
- const pk3 = pkWithDoc('../test_data/usx/opt_break.usx', {
16
- lang: 'fra',
17
- abbr: 'hello',
18
- })[0];
19
-
20
- test(
21
- `NBSP (${testGroup})`,
22
- async function (t) {
23
- try {
24
- t.plan(3);
25
- const query = `{ documents { mainSequence { blocks { items {type subType payload} } } } }`;
26
- const result = await pk.gqlQuery(query);
27
- t.equal(result.errors, undefined);
28
- const secondItem = result.data.documents[0].mainSequence.blocks[0].items[1];
29
- t.equal(secondItem.subType, 'lineSpace');
30
- t.equal(secondItem.payload, '\xa0');
31
- } catch (err) {
32
- console.log(err);
33
- }
34
- },
35
- );
36
-
37
- test(
38
- `Soft line break with USFM (${testGroup})`,
39
- async function (t) {
40
- try {
41
- t.plan(3);
42
- const query = `{ documents { mainSequence { blocks { items {type subType payload} } } } }`;
43
- const result = await pk2.gqlQuery(query);
44
- t.equal(result.errors, undefined);
45
- const secondItem = result.data.documents[0].mainSequence.blocks[0].items[1];
46
- t.equal(secondItem.subType, 'softLineBreak');
47
- t.equal(secondItem.payload, '//');
48
- } catch (err) {
49
- console.log(err);
50
- }
51
- },
52
- );
53
-
54
- test(
55
- `Soft line break with USX (${testGroup})`,
56
- async function (t) {
57
- try {
58
- t.plan(5);
59
- const query = `{ documents { sequences { type blocks { items {type subType payload} } } } }`;
60
- const result = await pk3.gqlQuery(query);
61
- t.equal(result.errors, undefined);
62
- const sequences = result.data.documents[0].sequences;
63
- const headingSequence = sequences.filter(s => s.type === 'heading')[0];
64
- t.equal(headingSequence.blocks[0].items[3].subType, 'softLineBreak');
65
- t.equal(headingSequence.blocks[0].items[3].payload, '//');
66
- const titleSequence = sequences.filter(s => s.type === 'title')[0];
67
- t.equal(titleSequence.blocks[0].items[3].subType, 'softLineBreak');
68
- t.equal(titleSequence.blocks[0].items[3].payload, '//');
69
- } catch (err) {
70
- console.log(err);
71
- }
72
- },
73
- );
@@ -1,36 +0,0 @@
1
- const test = require('tape');
2
-
3
- const { pkWithDocs } = require('../../lib/load.js');
4
-
5
- const testGroup = 'Checksum';
6
-
7
- test(
8
- `4 docs in 3 docSets (${testGroup})`,
9
- function (t) {
10
- try {
11
- t.plan(1);
12
- const pk = pkWithDocs([
13
- ['../test_data/usx/web_psa150.usx', {
14
- lang: 'eng',
15
- abbr: 'webbe',
16
- }],
17
- ['../test_data/usx/web_rut.usx', {
18
- lang: 'eng',
19
- abbr: 'webbe',
20
- }],
21
- ['../test_data/usfm/ust_psa.usfm', {
22
- lang: 'eng',
23
- abbr: 'ust',
24
- }],
25
- ['../test_data/usx/not_nfc18_phm.usx', {
26
- lang: 'eng',
27
- abbr: 'nnfc18',
28
- }],
29
- ]);
30
- const cs = pk.checksum();
31
- t.ok(cs);
32
- } catch (err) {
33
- console.log(err);
34
- }
35
- },
36
- );
@@ -1,35 +0,0 @@
1
- const test = require('tape');
2
-
3
- const { pkWithDoc } = require('../../lib/load.js');
4
-
5
- const testGroup = 'Global CL';
6
-
7
- const [pk] = pkWithDoc('../test_data/usfm/cl.usfm', {
8
- lang: 'eng',
9
- abbr: 'ult',
10
- });
11
-
12
- test(
13
- `Global CL (${testGroup})`,
14
- async function (t) {
15
- try {
16
- t.plan(5);
17
- const query = '{ documents { headers { key value } sequences { type blocks { text } } } }';
18
- const result = await pk.gqlQuery(query);
19
- t.equal(result.errors, undefined);
20
- const titleSequence = result.data.documents[0].sequences.filter(s => s.type === 'title')[0];
21
- t.equal(titleSequence.blocks.length, 1);
22
- t.equal(titleSequence.blocks[0].text, 'Psalms');
23
- const headersArray = result.data.documents[0].headers;
24
- const headers = {};
25
-
26
- for (const header of headersArray) {
27
- headers[header.key] = header.value;
28
- }
29
- t.ok('cl' in headers);
30
- t.equal(headers.cl, 'Psalm');
31
- } catch (err) {
32
- console.log(err);
33
- }
34
- },
35
- );
@@ -1,18 +0,0 @@
1
- /* eslint-disable require-await */
2
- const test = require('tape');
3
- const { preTokenClassForFragment } = require('../../../src/parser/lexers/object_for_fragment.cjs');
4
- const { lexingRegexes } = require('../../../src/parser/lexers/lexingRegexes.cjs');
5
-
6
- const testGroup = 'Class for Fragment';
7
-
8
- test(
9
- `Exception (${testGroup})`,
10
- async function (t) {
11
- try {
12
- t.plan(1);
13
- t.throws(() => preTokenClassForFragment('', lexingRegexes));
14
- } catch (err) {
15
- console.log(err);
16
- }
17
- },
18
- );
@@ -1,46 +0,0 @@
1
- /* eslint-disable require-await */
2
- const path = require('path');
3
- const test = require('tape');
4
- const fse = require('fs-extra');
5
- const { Proskomma } = require('../../../src/index.cjs');
6
-
7
- const testGroup = 'cleanUSFM';
8
-
9
- test(
10
- `Remove chapters (${testGroup})`,
11
- async function (t) {
12
- try {
13
- t.plan(2);
14
- const pk = new Proskomma();
15
- let fp = '../../test_data/usfm/frt.usfm';
16
- let content = fse.readFileSync(path.resolve(__dirname, fp));
17
- let cleanedLines = pk.cleanUsfm(content, { remove: ['\\c'] })
18
- .split('\n')
19
- .filter(l => l.length > 0);
20
- t.equal(cleanedLines.length, 4);
21
- t.equal(cleanedLines[1], '\\mt1 USFM');
22
- } catch (err) {
23
- console.log(err);
24
- }
25
- },
26
- );
27
-
28
- test(
29
- `Keep chapters (${testGroup})`,
30
- async function (t) {
31
- try {
32
- t.plan(3);
33
- const pk = new Proskomma();
34
- let fp = '../../test_data/usfm/frt.usfm';
35
- let content = fse.readFileSync(path.resolve(__dirname, fp));
36
- let cleanedLines = pk.cleanUsfm(content)
37
- .split('\n')
38
- .filter(l => l.length > 0);
39
- t.equal(cleanedLines.length, 5);
40
- t.equal(cleanedLines[1], '\\mt1 USFM');
41
- t.equal(cleanedLines[3], '\\c 1');
42
- } catch (err) {
43
- console.log(err);
44
- }
45
- },
46
- );