Skip to content
This repository has been archived by the owner on Feb 15, 2019. It is now read-only.

Added --merge and --only-missing command line switches. #43

Merged
merged 1 commit into from
May 13, 2016
Merged

Added --merge and --only-missing command line switches. #43

merged 1 commit into from
May 13, 2016

Conversation

Kilowhisky
Copy link
Contributor

This is a rebase of #1

@Kilowhisky
Copy link
Contributor Author

Also i'm not sure whats going on but when i install my branch manually the lib folder doesn't get created / copied. Any ideas?


it('handles option --merge', function() {
return emberI18nCsv('to-js', 'tmp/locales', 'test/fixtures/i18n-merge.csv', { merge: true }).then(() => {
return areDirsEqual('tmp/locales', 'test/fixtures/locales').then(areSame => {
Copy link
Owner

Choose a reason for hiding this comment

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

It doesn't look like this is testing anything. The beforeEach is copying 'test/fixtures/locales' into tmp, then you are asserting the result of the merge is equal to what's in 'test/fixtures/locales'. So it appears the merge is having no affect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm testing that the merge does not clobber the translations that are present already but not in the .csv file. This is successful because the .csv is a subset of the tmp/locales. Should i add an additional test that checks to see if additions are properly added?

Copy link
Owner

Choose a reason for hiding this comment

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

Yea, then I think that new test can replace this test, because it will cover the merge protection and the additional properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kellyselden
Copy link
Owner

kellyselden commented May 6, 2016

Also i'm not sure whats going on but when i install my branch manually the lib folder doesn't get created / copied. Any ideas?

@Kilowhisky It is ignored in https://github.com/kellyselden/ember-i18n-csv/blob/master/.npmignore#L2, since it is babel code it gets compiled to '/dist'

ps.on('exit', () => {
expect(out).to.equal('');
expect(err).to.equal('');
areDirsEqual('tmp/locales', 'test/fixtures/locales').then(areSame => {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this needs to check 'test/fixtures/locales-merge' as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done again. But i'm not exactly sure why the test wasn't failing before. I've never used this test suite before so i'm kinda shooting in the dark here.

Copy link
Owner

Choose a reason for hiding this comment

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

It's because your source on line 61, "test/fixtures/locales", doesn't have any missing keys. You should probably use "test/fixtures/locales-with-missing-keys" as your source to properly test. Then your merge file should have additional keys, but also some missing keys to test that the source keys are preserved.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@kellyselden
Copy link
Owner

The tests look great now. If you could just squash commits into one, this will be ready to merge. Thanks for all your work!

@Kilowhisky
Copy link
Contributor Author

Think that should do it.

@kellyselden kellyselden merged commit ae7e6a2 into kellyselden:master May 13, 2016
@kellyselden
Copy link
Owner

Beautiful. Thank you very much!

@kellyselden
Copy link
Owner

Released v0.1.0.

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

Successfully merging this pull request may close these issues.

2 participants