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

Fix API error & tests #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

pchaigno
Copy link

@pchaigno pchaigno commented Mar 9, 2016

This pull request first fixes the tests:

  • I removed the Grunt dependency and updated the .travis.yml file.
  • I used hubot-test-helper to write simple tests.

Then, @awailly was able to fix the API error (#7) 🙇
He extracted a necessary piece of code from Google JS code in order to compute one of the request parameters. More explanations can be found at soimort/translate-shell#94.

The new tests are more functional tests than unit tests but this will enable us to track any breaking change in Google Translate's API. I also used tests sentences which are fairly unlikely to change.

You will need to enable Travis tests on the repository to run the tests. In the meantime, you can see the results here ;)

EDIT: For a temporary fix, you can use the following in your project:

"dependencies": {
    "hubot-google-translate": "awailly/hubot-google-translate#fix-tests",
},

pchaigno and others added 4 commits March 9, 2016 12:20
Stop using Grunt
Tests are still failing because of hubot-archive#7 (Google changed its API)
Add dependencies to be able to wait for the API response
Used translations which are unlikely to change
pchaigno added a commit to pchaigno/hewbot that referenced this pull request Mar 9, 2016
@pchaigno pchaigno changed the title Fix tests Fix API error & tests Mar 10, 2016
@pchaigno
Copy link
Author

@technicalpickles Did you get a chance to look into this?

@technicalpickles
Copy link
Contributor

I haven't, but I'm not the only maintainer on this.

I removed the Grunt dependency

Why? Grunt is used for releasing in addition to tests.

@technicalpickles
Copy link
Contributor

I'm looking briefly at the new functions added, and I'm having a real hard time understanding them. I would recommend using intention revealing variable names instead of one or two letter variables. I'm also not sure what tk is supposed to do, or why this fixes it. It might be worth linking to relevant Google Translate API documentation to make it easier for casual contributors to understand what is going on.

@pchaigno
Copy link
Author

I haven't, but I'm not the only maintainer on this.

Sorry for the direct ping. I wasn't sure anyone was receiving notifications for issues/PR opened on this repository and it's rather difficult to identify the maintainers of a repository 😕

Why? Grunt is used for releasing in addition to tests.

The "Grunt tests" weren't working (some dependency issue at least).
I thought it was remnants from when Hubot scripts were all in one dedicated repository.
I'll install it back and try to fix it 😃

I'm looking briefly at the new functions added, and I'm having a real hard time understanding them. I would recommend using intention revealing variable names instead of one or two letter variables. I'm also not sure what tk is supposed to do, or why this fixes it. It might be worth linking to relevant Google Translate API documentation to make it easier for casual contributors to understand what is going on.

This piece of code you're referring to has been extracted directly from Google's compressed JS code. I don't think there is a documentation on that and I'm not sure of the actual purpose of tk.
@awailly might know more...?

@awailly
Copy link

awailly commented Mar 15, 2016

The code is directly extracted from the google translate js page. There is no point is documenting this part, or having a proper variable naming, as it can change soon for another completely different piece of code. Furthermore, this is not documented anywhere in the API.

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

Successfully merging this pull request may close these issues.

3 participants