Skip to content

Commit

Permalink
fix: add Mytischi to exceptions
Browse files Browse the repository at this point in the history
* Added Mytischi to exceptions, improved test coverage

* test: fix hint
  • Loading branch information
akaSybe authored and nodkz committed Jul 16, 2019
1 parent cca8e0e commit d04b7a6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/city-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('lvovich/city', () => {
const fromTest = `${arg}, ${res1}, ${res2}, ${res3}`;
if (generated !== fromTest) {
console.error(
'Format HINT: [city|именит, cityIn|предлож, cityFrom|родит, cityTo]\n' +
'Format HINT: [city|именит, cityIn|предлож, cityFrom|родит, cityTo|направительный]\n' +
`Generated: ${arg}, в ${cityIn(arg)}, из ${cityFrom(arg)}, to ${cityTo(arg)}\n` +
`In test file: ${arg}, в ${res1}, из ${res2}, to ${res3}`
);
Expand Down Expand Up @@ -298,7 +298,7 @@ describe('lvovich/city', () => {
Химки, Химках, Химков, Химки
Березники, Березниках, Березников, Березники
Ессентуки, Ессентуках, Ессентуков, Ессентуки
Мытищи, Мытищах, Мытищев, Мытищи
Мытищи, Мытищах, Мытищ, Мытищи
Нижний Новгород, Нижнем Новгороде, Нижнего Новгорода, Нижний Новгород
Нижний Тагил, Нижнем Тагиле, Нижнего Тагила, Нижний Тагил
Великий Новгород, Великом Новгороде, Великого Новгорода, Великий Новгород
Expand Down
4 changes: 4 additions & 0 deletions src/__tests__/gender-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ describe('lvovich/gender', () => {
},
};

it('should return null if name is empty', () => {
expect(getGenderByRuleSet('', ruleSet)).toEqual(null);
});

it('should check exceptions firstly', () => {
expect(getGenderByRuleSet('Дарвин', ruleSet)).toEqual(ANDROGYNOUS);
});
Expand Down
4 changes: 4 additions & 0 deletions src/rules/cityRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ const cityInflections: DeclensionCityRuleSetT = {
test: ['ще'], // Хлевище, Городище
mods: ['-а', '-у', '', 'м', ''],
},
{
test: ['щи'], // Мытищи
mods: ['-', '-ам', '', '-ами', '-ах'],
},
{
test: ['чье'], // Щучье
mods: ['-я', '-ю', '', 'м', ''],
Expand Down

0 comments on commit d04b7a6

Please sign in to comment.