Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#11 Add tests for i18n-lang-js technology #18

Merged
merged 20 commits into from
May 20, 2015
Merged

#11 Add tests for i18n-lang-js technology #18

merged 20 commits into from
May 20, 2015

Conversation

tormozz48
Copy link
Contributor

Please review it

@blond @sipayRT

@@ -1 +1,3 @@
.idea
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

может лучше это добавить в свой глобальный .gitignore?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да, такое нужно уносить в свой ~/.gitignore.

@@ -34,6 +34,7 @@
},
"devDependencies": {
"enb": ">= 0.11.0 < 1.0.0",
"istanbul": "0.3.14",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

пакеты ниже можно сразу обновить

@blond
Copy link
Member

blond commented May 20, 2015

Нужно добавить тест на случай, когда файл с кейсетами пустой.

@tormozz48
Copy link
Contributor Author

"Нужно добавить тест на случай, когда файл с кейсетами пустой."

  1. А такой кейс реальный?
  2. Пустой - это совсем пустой или module.exports = {} ?
  3. Что мы должны получить в таком случае?

@blond

@blond
Copy link
Member

blond commented May 20, 2015

А такой кейс реальный?

Да

Пустой - это совсем пустой или module.exports = {} ?

module.exports = {};

Что мы должны получить в таком случае?

Что-то в таком духе:

if (typeof BEM !== \'undefined\' && BEM.I18N) {
    BEM.I18N.lang(\'' + lang + '\');
}

@tormozz48
Copy link
Contributor Author

Я исправил все замечания по этому pr.
Требуется вердикт

@sipayRT
Copy link

sipayRT commented May 20, 2015

ну если тебе не по душе унести схему, то у меня других заметок нет. Кстати, посмотри, плз, мой комментарий - ты на него не ответил.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling ce8c692 on #11 into * on master*.

@tadatuta
Copy link
Member

кмк, пустой-пустой тоже может иметь смысл проверять, например, если файл с переводами закомментировали:

// module.exports = {
//  
// }

})
}
},
expected = [
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

у тебя в двух тестах этот массив отличается только одним айтемом - ' "key": \'val2\''. Его можно перенести в buildWithCache, а в функцию уже передавать параметром expected что ты ожидаешь получить - 'val1' или 'val2'. Мне кажется, что станет красивее :) (имхо)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Сделал как ты сказал

@tormozz48
Copy link
Contributor Author

"кмк, пустой-пустой тоже может иметь смысл проверять, например, если файл с переводами закомментировали:" - этот файл получается в результате работы предыдущей технологии i18n-merge-keysets.js и является автогенеренным. Сложно представить что его могули закомментировать

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling aa86f8d on #11 into * on master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling d6ba8aa on #11 into * on master*.

@sipayRT
Copy link

sipayRT commented May 20, 2015

@tormozz48 во, вот последний коммит прям красивый :)
Вот такое же я бы сделал и для expected как-то так:

expected = [
    'if (typeof BEM !== \'undefined\' && BEM.I18N) {BEM.I18N.decl(\'scope\', {',
    '    "key": ' + (initial.mtime === modified.mtime) ? initial.val : modified.val,
    '}, {',
    '"lang": "lang"',
    '});',
    '',
    'BEM.I18N.lang(\'lang\');',
    '',
    '}',
    ''
].join('\n');

но если считаешь, что это нечитабельно, то можно забить

@sipayRT
Copy link

sipayRT commented May 20, 2015

в общем, у меня всё :)

@tormozz48
Copy link
Contributor Author

@sipayRT
Насчет expected есть 2 возражения:

  1. Во-первых он и так с трудом читаемый
  2. Любые дополнительные абстракции усложняют понимание

@sipayRT
Copy link

sipayRT commented May 20, 2015

@tormozz48 вот я об этом и говорю - не понятно что в этом большом куске кода должно поменяться. А переменные хоть подсветятся :) Но я не настаиваю, можно и так оставить

blond added a commit that referenced this pull request May 20, 2015
#11 Add tests for i18n-lang-js technology
@blond blond merged commit faf52ad into master May 20, 2015
@blond blond removed the in progress label May 20, 2015
@blond blond deleted the #11 branch May 20, 2015 13:36
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 132e6af on #11 into * on master*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants