shevchenko 2.1.2 → 2.2.0
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/.eslintrc.json +53 -0
- package/.prettierrc.json +5 -0
- package/dist/cjs/shevchenko.js +1307 -122
- package/dist/cjs/shevchenko.js.map +1 -1
- package/dist/es/shevchenko.js +1310 -128
- package/dist/es/shevchenko.js.map +1 -1
- package/dist/types/anthroponym-inflection/anthroponym-inflector.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/command-runner-factory.d.ts +1 -1
- package/dist/types/anthroponym-inflection/command-runner-factory.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/first-name-inflector.d.ts +1 -1
- package/dist/types/anthroponym-inflection/first-name-inflector.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/last-name-inflector.d.ts +1 -1
- package/dist/types/anthroponym-inflection/last-name-inflector.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/middle-name-inflector.d.ts +1 -1
- package/dist/types/anthroponym-inflection/middle-name-inflector.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/name-inflector.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/replace-command-runner.d.ts +1 -1
- package/dist/types/anthroponym-inflection/replace-command-runner.d.ts.map +1 -1
- package/dist/types/anthroponym-inflection/rule-inflector.d.ts.map +1 -1
- package/dist/types/bootstrap.d.ts.map +1 -1
- package/dist/types/core/validator.d.ts.map +1 -1
- package/dist/types/gender-detection/detect-gender.d.ts +11 -0
- package/dist/types/gender-detection/detect-gender.d.ts.map +1 -0
- package/dist/types/gender-detection/index.d.ts +2 -0
- package/dist/types/gender-detection/index.d.ts.map +1 -0
- package/dist/types/part-of-speech-recognition/neural-network.d.ts +1 -1
- package/dist/types/part-of-speech-recognition/neural-network.d.ts.map +1 -1
- package/dist/types/part-of-speech-recognition/part-of-speech-decoder.d.ts.map +1 -1
- package/dist/types/part-of-speech-recognition/part-of-speech-recognition-rule.d.ts +1 -1
- package/dist/types/part-of-speech-recognition/part-of-speech-recognition-rule.d.ts.map +1 -1
- package/dist/types/part-of-speech-recognition/part-of-speech-recognizer.d.ts +1 -1
- package/dist/types/part-of-speech-recognition/part-of-speech-recognizer.d.ts.map +1 -1
- package/dist/types/shevchenko.d.ts +3 -2
- package/dist/types/shevchenko.d.ts.map +1 -1
- package/dist/types/utils/string.utils.d.ts.map +1 -1
- package/dist/umd/shevchenko.min.js +4 -4
- package/dist/umd/shevchenko.min.js.map +1 -1
- package/nuxt/components/declension-demo.vue +7 -1
- package/nuxt/components/declension-form.vue +77 -10
- package/nuxt/components/declension-results.vue +26 -7
- package/nuxt/components/how-it-works.vue +10 -10
- package/nuxt/composables/declension.ts +47 -4
- package/nuxt/data/female-first-names.json +556 -0
- package/nuxt/data/male-first-names.json +603 -0
- package/nuxt/locales/en-US.json +6 -3
- package/nuxt/locales/uk-UA.json +8 -5
- package/nuxt/package-lock.json +7 -7
- package/nuxt/package.json +2 -2
- package/package.json +13 -10
- package/src/anthroponym-inflection/anthroponym-inflector.ts +20 -5
- package/src/anthroponym-inflection/command-runner-factory.ts +2 -2
- package/src/anthroponym-inflection/first-name-inflector.ts +5 -5
- package/src/anthroponym-inflection/inflector.types.ts +19 -19
- package/src/anthroponym-inflection/last-name-inflector.ts +10 -6
- package/src/anthroponym-inflection/middle-name-inflector.ts +5 -5
- package/src/anthroponym-inflection/name-inflector.ts +9 -3
- package/src/anthroponym-inflection/replace-command-runner.ts +1 -1
- package/src/anthroponym-inflection/rule-inflector.ts +2 -2
- package/src/bootstrap.ts +10 -10
- package/src/core/validator.ts +12 -5
- package/src/gender-detection/detect-gender.ts +43 -0
- package/src/gender-detection/given-names-genders.json +1144 -0
- package/src/gender-detection/index.ts +1 -0
- package/src/part-of-speech-recognition/neural-network.ts +10 -5
- package/src/part-of-speech-recognition/part-of-speech-decoder.ts +1 -1
- package/src/part-of-speech-recognition/part-of-speech-recognition-rule.ts +6 -2
- package/src/part-of-speech-recognition/part-of-speech-recognizer.ts +2 -2
- package/src/part-of-speech-recognition/word-encoder.ts +2 -2
- package/src/resources/inflector/rules.json +27 -26
- package/src/shevchenko.ts +4 -3
- package/src/utils/string.utils.ts +3 -3
- package/test/anthroponym-inflection.js +58 -0
- package/test/gender-detection.js +29 -0
- package/test/input-validation.js +353 -0
- package/test/main.test.js +18 -0
- package/test/samples.json +7282 -0
- package/tsconfig.types.json +9 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
module.exports = (shevchenko) => {
|
|
2
|
+
describe('shevchenko', () => {
|
|
3
|
+
it('should throw an error for empty arguments list', () => {
|
|
4
|
+
expect(() => shevchenko.inNominative()).toThrow(
|
|
5
|
+
TypeError,
|
|
6
|
+
'"anthroponym" must be an object.',
|
|
7
|
+
);
|
|
8
|
+
expect(() => shevchenko.inGenitive()).toThrow(TypeError, '"anthroponym" must be an object.');
|
|
9
|
+
expect(() => shevchenko.inDative()).toThrow(TypeError, '"anthroponym" must be an object.');
|
|
10
|
+
expect(() => shevchenko.inAccusative()).toThrow(
|
|
11
|
+
TypeError,
|
|
12
|
+
'"anthroponym" must be an object.',
|
|
13
|
+
);
|
|
14
|
+
expect(() => shevchenko.inAblative()).toThrow(TypeError, '"anthroponym" must be an object.');
|
|
15
|
+
expect(() => shevchenko.inLocative()).toThrow(TypeError, '"anthroponym" must be an object.');
|
|
16
|
+
expect(() => shevchenko.inVocative()).toThrow(TypeError, '"anthroponym" must be an object.');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should throw an error if unsupported gender provided', () => {
|
|
20
|
+
const anthroponym = {
|
|
21
|
+
gender: 'nonbinary',
|
|
22
|
+
firstName: 'Тарас',
|
|
23
|
+
middleName: 'Григорович',
|
|
24
|
+
lastName: 'Шевченко',
|
|
25
|
+
};
|
|
26
|
+
expect(() => shevchenko.inNominative(anthroponym)).toThrow(
|
|
27
|
+
TypeError,
|
|
28
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
29
|
+
);
|
|
30
|
+
expect(() => shevchenko.inGenitive(anthroponym)).toThrow(
|
|
31
|
+
TypeError,
|
|
32
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
33
|
+
);
|
|
34
|
+
expect(() => shevchenko.inDative(anthroponym)).toThrow(
|
|
35
|
+
TypeError,
|
|
36
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
37
|
+
);
|
|
38
|
+
expect(() => shevchenko.inAccusative(anthroponym)).toThrow(
|
|
39
|
+
TypeError,
|
|
40
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
41
|
+
);
|
|
42
|
+
expect(() => shevchenko.inAblative(anthroponym)).toThrow(
|
|
43
|
+
TypeError,
|
|
44
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
45
|
+
);
|
|
46
|
+
expect(() => shevchenko.inLocative(anthroponym)).toThrow(
|
|
47
|
+
TypeError,
|
|
48
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
49
|
+
);
|
|
50
|
+
expect(() => shevchenko.inVocative(anthroponym)).toThrow(
|
|
51
|
+
TypeError,
|
|
52
|
+
'"anthroponym.gender" must be one of the following: "male", "female".',
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should throw an error if none of the name fields provided', () => {
|
|
57
|
+
const anthroponym = { gender: 'male' };
|
|
58
|
+
expect(() => shevchenko.inNominative(anthroponym)).toThrow(
|
|
59
|
+
TypeError,
|
|
60
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
61
|
+
);
|
|
62
|
+
expect(() => shevchenko.inGenitive(anthroponym)).toThrow(
|
|
63
|
+
TypeError,
|
|
64
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
65
|
+
);
|
|
66
|
+
expect(() => shevchenko.inDative(anthroponym)).toThrow(
|
|
67
|
+
TypeError,
|
|
68
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
69
|
+
);
|
|
70
|
+
expect(() => shevchenko.inAccusative(anthroponym)).toThrow(
|
|
71
|
+
TypeError,
|
|
72
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
73
|
+
);
|
|
74
|
+
expect(() => shevchenko.inAblative(anthroponym)).toThrow(
|
|
75
|
+
TypeError,
|
|
76
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
77
|
+
);
|
|
78
|
+
expect(() => shevchenko.inLocative(anthroponym)).toThrow(
|
|
79
|
+
TypeError,
|
|
80
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
81
|
+
);
|
|
82
|
+
expect(() => shevchenko.inVocative(anthroponym)).toThrow(
|
|
83
|
+
TypeError,
|
|
84
|
+
'At least one of the following fields must present: "anthroponym.firstName", "anthroponym.middleName", "anthroponym.lastName".',
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should throw an error if provided first name is not a string', () => {
|
|
89
|
+
const anthroponym = {
|
|
90
|
+
gender: 'male',
|
|
91
|
+
firstName: null,
|
|
92
|
+
middleName: 'Григорович',
|
|
93
|
+
lastName: 'Шевченко',
|
|
94
|
+
};
|
|
95
|
+
expect(() => shevchenko.inNominative(anthroponym)).toThrow(
|
|
96
|
+
TypeError,
|
|
97
|
+
'"anthroponym.firstName" must be a string.',
|
|
98
|
+
);
|
|
99
|
+
expect(() => shevchenko.inGenitive(anthroponym)).toThrow(
|
|
100
|
+
TypeError,
|
|
101
|
+
'"anthroponym.firstName" must be a string.',
|
|
102
|
+
);
|
|
103
|
+
expect(() => shevchenko.inDative(anthroponym)).toThrow(
|
|
104
|
+
TypeError,
|
|
105
|
+
'"anthroponym.firstName" must be a string.',
|
|
106
|
+
);
|
|
107
|
+
expect(() => shevchenko.inAccusative(anthroponym)).toThrow(
|
|
108
|
+
TypeError,
|
|
109
|
+
'"anthroponym.firstName" must be a string.',
|
|
110
|
+
);
|
|
111
|
+
expect(() => shevchenko.inAblative(anthroponym)).toThrow(
|
|
112
|
+
TypeError,
|
|
113
|
+
'"anthroponym.firstName" must be a string.',
|
|
114
|
+
);
|
|
115
|
+
expect(() => shevchenko.inLocative(anthroponym)).toThrow(
|
|
116
|
+
TypeError,
|
|
117
|
+
'"anthroponym.firstName" must be a string.',
|
|
118
|
+
);
|
|
119
|
+
expect(() => shevchenko.inVocative(anthroponym)).toThrow(
|
|
120
|
+
TypeError,
|
|
121
|
+
'"anthroponym.firstName" must be a string.',
|
|
122
|
+
);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should throw an error if provided middle name is not a string', () => {
|
|
126
|
+
const anthroponym = {
|
|
127
|
+
gender: 'male',
|
|
128
|
+
firstName: 'Тарас',
|
|
129
|
+
middleName: null,
|
|
130
|
+
lastName: 'Шевченко',
|
|
131
|
+
};
|
|
132
|
+
expect(() => shevchenko.inNominative(anthroponym)).toThrow(
|
|
133
|
+
TypeError,
|
|
134
|
+
'"anthroponym.middleName" must be a string.',
|
|
135
|
+
);
|
|
136
|
+
expect(() => shevchenko.inGenitive(anthroponym)).toThrow(
|
|
137
|
+
TypeError,
|
|
138
|
+
'"anthroponym.middleName" must be a string.',
|
|
139
|
+
);
|
|
140
|
+
expect(() => shevchenko.inDative(anthroponym)).toThrow(
|
|
141
|
+
TypeError,
|
|
142
|
+
'"anthroponym.middleName" must be a string.',
|
|
143
|
+
);
|
|
144
|
+
expect(() => shevchenko.inAccusative(anthroponym)).toThrow(
|
|
145
|
+
TypeError,
|
|
146
|
+
'"anthroponym.middleName" must be a string.',
|
|
147
|
+
);
|
|
148
|
+
expect(() => shevchenko.inAblative(anthroponym)).toThrow(
|
|
149
|
+
TypeError,
|
|
150
|
+
'"anthroponym.middleName" must be a string.',
|
|
151
|
+
);
|
|
152
|
+
expect(() => shevchenko.inLocative(anthroponym)).toThrow(
|
|
153
|
+
TypeError,
|
|
154
|
+
'"anthroponym.middleName" must be a string.',
|
|
155
|
+
);
|
|
156
|
+
expect(() => shevchenko.inVocative(anthroponym)).toThrow(
|
|
157
|
+
TypeError,
|
|
158
|
+
'"anthroponym.middleName" must be a string.',
|
|
159
|
+
);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('should throw an error if provided last name is not a string', () => {
|
|
163
|
+
const anthroponym = {
|
|
164
|
+
gender: 'male',
|
|
165
|
+
firstName: 'Тарас',
|
|
166
|
+
middleName: 'Григорович',
|
|
167
|
+
lastName: null,
|
|
168
|
+
};
|
|
169
|
+
expect(() => shevchenko.inNominative(anthroponym)).toThrow(
|
|
170
|
+
TypeError,
|
|
171
|
+
'"anthroponym.lastName" must be a string.',
|
|
172
|
+
);
|
|
173
|
+
expect(() => shevchenko.inGenitive(anthroponym)).toThrow(
|
|
174
|
+
TypeError,
|
|
175
|
+
'"anthroponym.lastName" must be a string.',
|
|
176
|
+
);
|
|
177
|
+
expect(() => shevchenko.inDative(anthroponym)).toThrow(
|
|
178
|
+
TypeError,
|
|
179
|
+
'"anthroponym.lastName" must be a string.',
|
|
180
|
+
);
|
|
181
|
+
expect(() => shevchenko.inAccusative(anthroponym)).toThrow(
|
|
182
|
+
TypeError,
|
|
183
|
+
'"anthroponym.lastName" must be a string.',
|
|
184
|
+
);
|
|
185
|
+
expect(() => shevchenko.inAblative(anthroponym)).toThrow(
|
|
186
|
+
TypeError,
|
|
187
|
+
'"anthroponym.lastName" must be a string.',
|
|
188
|
+
);
|
|
189
|
+
expect(() => shevchenko.inLocative(anthroponym)).toThrow(
|
|
190
|
+
TypeError,
|
|
191
|
+
'"anthroponym.lastName" must be a string.',
|
|
192
|
+
);
|
|
193
|
+
expect(() => shevchenko.inVocative(anthroponym)).toThrow(
|
|
194
|
+
TypeError,
|
|
195
|
+
'"anthroponym.lastName" must be a string.',
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should inflect anthroponym if first name provided', () => {
|
|
200
|
+
const anthroponym = { gender: 'male', firstName: 'Тарас' };
|
|
201
|
+
expect(shevchenko.inNominative(anthroponym)).toStrictEqual({
|
|
202
|
+
gender: 'male',
|
|
203
|
+
firstName: 'Тарас',
|
|
204
|
+
});
|
|
205
|
+
expect(shevchenko.inGenitive(anthroponym)).toStrictEqual({
|
|
206
|
+
gender: 'male',
|
|
207
|
+
firstName: 'Тараса',
|
|
208
|
+
});
|
|
209
|
+
expect(shevchenko.inDative(anthroponym)).toStrictEqual({
|
|
210
|
+
gender: 'male',
|
|
211
|
+
firstName: 'Тарасу',
|
|
212
|
+
});
|
|
213
|
+
expect(shevchenko.inAccusative(anthroponym)).toStrictEqual({
|
|
214
|
+
gender: 'male',
|
|
215
|
+
firstName: 'Тараса',
|
|
216
|
+
});
|
|
217
|
+
expect(shevchenko.inAblative(anthroponym)).toStrictEqual({
|
|
218
|
+
gender: 'male',
|
|
219
|
+
firstName: 'Тарасом',
|
|
220
|
+
});
|
|
221
|
+
expect(shevchenko.inLocative(anthroponym)).toStrictEqual({
|
|
222
|
+
gender: 'male',
|
|
223
|
+
firstName: 'Тарасові',
|
|
224
|
+
});
|
|
225
|
+
expect(shevchenko.inVocative(anthroponym)).toStrictEqual({
|
|
226
|
+
gender: 'male',
|
|
227
|
+
firstName: 'Тарасе',
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('should inflect anthroponym if middle name provided', () => {
|
|
232
|
+
const anthroponym = { gender: 'male', middleName: 'Григорович' };
|
|
233
|
+
expect(shevchenko.inNominative(anthroponym)).toStrictEqual({
|
|
234
|
+
gender: 'male',
|
|
235
|
+
middleName: 'Григорович',
|
|
236
|
+
});
|
|
237
|
+
expect(shevchenko.inGenitive(anthroponym)).toStrictEqual({
|
|
238
|
+
gender: 'male',
|
|
239
|
+
middleName: 'Григоровича',
|
|
240
|
+
});
|
|
241
|
+
expect(shevchenko.inDative(anthroponym)).toStrictEqual({
|
|
242
|
+
gender: 'male',
|
|
243
|
+
middleName: 'Григоровичу',
|
|
244
|
+
});
|
|
245
|
+
expect(shevchenko.inAccusative(anthroponym)).toStrictEqual({
|
|
246
|
+
gender: 'male',
|
|
247
|
+
middleName: 'Григоровича',
|
|
248
|
+
});
|
|
249
|
+
expect(shevchenko.inAblative(anthroponym)).toStrictEqual({
|
|
250
|
+
gender: 'male',
|
|
251
|
+
middleName: 'Григоровичем',
|
|
252
|
+
});
|
|
253
|
+
expect(shevchenko.inLocative(anthroponym)).toStrictEqual({
|
|
254
|
+
gender: 'male',
|
|
255
|
+
middleName: 'Григоровичу',
|
|
256
|
+
});
|
|
257
|
+
expect(shevchenko.inVocative(anthroponym)).toStrictEqual({
|
|
258
|
+
gender: 'male',
|
|
259
|
+
middleName: 'Григоровичу',
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('should inflect anthroponym if last name provided', () => {
|
|
264
|
+
const anthroponym = { gender: 'male', lastName: 'Шевченко' };
|
|
265
|
+
expect(shevchenko.inNominative(anthroponym)).toStrictEqual({
|
|
266
|
+
gender: 'male',
|
|
267
|
+
lastName: 'Шевченко',
|
|
268
|
+
});
|
|
269
|
+
expect(shevchenko.inGenitive(anthroponym)).toStrictEqual({
|
|
270
|
+
gender: 'male',
|
|
271
|
+
lastName: 'Шевченка',
|
|
272
|
+
});
|
|
273
|
+
expect(shevchenko.inDative(anthroponym)).toStrictEqual({
|
|
274
|
+
gender: 'male',
|
|
275
|
+
lastName: 'Шевченку',
|
|
276
|
+
});
|
|
277
|
+
expect(shevchenko.inAccusative(anthroponym)).toStrictEqual({
|
|
278
|
+
gender: 'male',
|
|
279
|
+
lastName: 'Шевченка',
|
|
280
|
+
});
|
|
281
|
+
expect(shevchenko.inAblative(anthroponym)).toStrictEqual({
|
|
282
|
+
gender: 'male',
|
|
283
|
+
lastName: 'Шевченком',
|
|
284
|
+
});
|
|
285
|
+
expect(shevchenko.inLocative(anthroponym)).toStrictEqual({
|
|
286
|
+
gender: 'male',
|
|
287
|
+
lastName: 'Шевченкові',
|
|
288
|
+
});
|
|
289
|
+
expect(shevchenko.inVocative(anthroponym)).toStrictEqual({
|
|
290
|
+
gender: 'male',
|
|
291
|
+
lastName: 'Шевченку',
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('should inflect anthroponym if full name provided', () => {
|
|
296
|
+
const anthroponym = {
|
|
297
|
+
gender: 'male',
|
|
298
|
+
firstName: 'Тарас',
|
|
299
|
+
middleName: 'Григорович',
|
|
300
|
+
lastName: 'Шевченко',
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
expect(shevchenko.inNominative(anthroponym)).toStrictEqual({
|
|
304
|
+
gender: 'male',
|
|
305
|
+
firstName: 'Тарас',
|
|
306
|
+
middleName: 'Григорович',
|
|
307
|
+
lastName: 'Шевченко',
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
expect(shevchenko.inGenitive(anthroponym)).toStrictEqual({
|
|
311
|
+
gender: 'male',
|
|
312
|
+
firstName: 'Тараса',
|
|
313
|
+
middleName: 'Григоровича',
|
|
314
|
+
lastName: 'Шевченка',
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
expect(shevchenko.inDative(anthroponym)).toStrictEqual({
|
|
318
|
+
gender: 'male',
|
|
319
|
+
firstName: 'Тарасу',
|
|
320
|
+
middleName: 'Григоровичу',
|
|
321
|
+
lastName: 'Шевченку',
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
expect(shevchenko.inAccusative(anthroponym)).toStrictEqual({
|
|
325
|
+
gender: 'male',
|
|
326
|
+
firstName: 'Тараса',
|
|
327
|
+
middleName: 'Григоровича',
|
|
328
|
+
lastName: 'Шевченка',
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
expect(shevchenko.inAblative(anthroponym)).toStrictEqual({
|
|
332
|
+
gender: 'male',
|
|
333
|
+
firstName: 'Тарасом',
|
|
334
|
+
middleName: 'Григоровичем',
|
|
335
|
+
lastName: 'Шевченком',
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
expect(shevchenko.inLocative(anthroponym)).toStrictEqual({
|
|
339
|
+
gender: 'male',
|
|
340
|
+
firstName: 'Тарасові',
|
|
341
|
+
middleName: 'Григоровичу',
|
|
342
|
+
lastName: 'Шевченкові',
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
expect(shevchenko.inVocative(anthroponym)).toStrictEqual({
|
|
346
|
+
gender: 'male',
|
|
347
|
+
firstName: 'Тарасе',
|
|
348
|
+
middleName: 'Григоровичу',
|
|
349
|
+
lastName: 'Шевченку',
|
|
350
|
+
});
|
|
351
|
+
});
|
|
352
|
+
});
|
|
353
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
const shevchenkoCjs = require('../dist/cjs/shevchenko');
|
|
3
|
+
const shevchenkoUmd = require('../dist/umd/shevchenko.min');
|
|
4
|
+
const execAnthroponymInflectionTests = require('./anthroponym-inflection');
|
|
5
|
+
const execGenderDetectionTests = require('./gender-detection');
|
|
6
|
+
const execInputValidationTests = require('./input-validation');
|
|
7
|
+
|
|
8
|
+
describe('CJS (CommonJS)', () => {
|
|
9
|
+
execInputValidationTests(shevchenkoCjs);
|
|
10
|
+
execAnthroponymInflectionTests(shevchenkoCjs);
|
|
11
|
+
execGenderDetectionTests(shevchenkoCjs);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
describe('UMD (Universal Module Definition)', () => {
|
|
15
|
+
execInputValidationTests(shevchenkoUmd);
|
|
16
|
+
execAnthroponymInflectionTests(shevchenkoUmd);
|
|
17
|
+
execGenderDetectionTests(shevchenkoUmd);
|
|
18
|
+
});
|