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

Goodparts refactor -- resolves #66 #69

Closed
wants to merge 8 commits into from

Conversation

newswim
Copy link
Collaborator

@newswim newswim commented Feb 7, 2017

Just one hanging point of review for me. On line 57, i wasn't totally sure about the {returns} value for JSDoc. Next time before tackling something like this, I should read over the source code (and readme) fully. If someone doesn't mind double checking me 🏁 --- that would make you the best 🏆

@newswim newswim changed the title Goodparts refactor -- fixes #66 Goodparts refactor -- fixes 66 Feb 7, 2017
@newswim newswim changed the title Goodparts refactor -- fixes 66 Goodparts refactor -- resolves #66 Feb 7, 2017
@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Current issue with Travis comes from that same error, TEMPLATE_DIRECTORY not being set. I resolved that locally, which leads to an error in one of the tests. Pursuing fix...

@nelsonic
Copy link
Member

nelsonic commented Feb 7, 2017

@Shouston3 would you mind peer-reviewing this PR? (please/thanks!)
(if you can help @newswim make the tests pass it would be ace!)

@nelsonic nelsonic requested a review from samhstn February 7, 2017 07:55
@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

@newswim You are now throwing an Error object here instead of a string.

So you should look to handle an object rather than a string in the tests here and in the other try catch statements

Instead of looking at e.indexOf, look at e.message

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017 via email

@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

The only way to address the failing tests and throw an error object is to change how we're handling the error in the tests

So I'd say change the tests just in regards to reading e.message instead of e.indexOf and leave the rest of the test file.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Ah, reread your message, Sam. I'll resolve this tomorrow. Thank you for looking!

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Almost there, I'm not sure about these last two tests. I'll go ahead and push what I've done. Is it normal with tape to get a error Command failed with exit code 1. after all the tests run?

@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

No it should be exit code 0

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

I just realized I'm not testing the type param. This seemed to be causing the tests to fail, whereas hardcoding them passed:


=============================== Coverage summary ===============================
Statements   : 96.67% ( 29/30 )
Branches     : 90% ( 9/10 )
Functions    : 100% ( 4/4 )
Lines        : 96.67% ( 29/30 )
================================================================================

@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

Note the compile_template function needs two arguments.
You are currently passing one and that could be causing the breakage

@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

Also, I think the email function should have the template name as the first argument and I think you've passed in a filename

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

hey @Shouston3, thanks for looking at this.

I had changed that because I was getting this error:

Error: ENOENT: no such file or directory, open './examples/templates/hello'

This is probably going to take some reworking.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Got it, filepath was getting declared wrong.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

🆘

screen shot 2017-02-07 at 12 24 40 pm

screen shot 2017-02-07 at 12 24 33 pm

I'm not sure how to test this, and I have a dentist appt in 15 minutes. I'm not sure how to handle this returned callback, please halp 😬

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Looks like an env variable is still not getting set. Sorry to have to leave it like this, be back in a few hours.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Well.. a little further. There was an error, and I guess I need to get aws keys now.

ses.sendEmail :: err: { InvalidClientTokenId: The security token included in the request is invalid.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

I believe this is now a matter of the env variables within the Travis machine not getting set.

see: https://travis-ci.org/dwyl/sendemail/builds/198932105#L126
compared with: https://travis-ci.org/dwyl/sendemail/builds/199391820

@codecov-io
Copy link

Codecov Report

Merging #69 into master will not impact coverage by -3.34%.

@@            Coverage Diff             @@
##           master      #69      +/-   ##
==========================================
- Coverage     100%   96.66%   -3.34%     
==========================================
  Files           1        1              
  Lines          29       30       +1     
==========================================
  Hits           29       29              
- Misses          0        1       +1
Impacted Files Coverage Δ
lib/index.js 96.66% <100%> (-3.34%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62f7ad4...9924704. Read the comment docs.

@newswim
Copy link
Collaborator Author

newswim commented Feb 7, 2017

Hmm.. my guess is that that last test isn't passing because of the other environment variables.

I just realized it's late in the day for you guys, so I'll leave this and wait until it has time for review tomorrow. I would also really like to know how environment variables are typically set with Travis (it's my first time using it). I wonder if this has something to do with:

Encrypted environment variables are not available to pull requests from forks due to the security risk of exposing such information to unknown code.

https://docs.travis-ci.com/user/environment-variables/#Defining-public-variables-in-.travis.yml

@samhstn
Copy link
Member

samhstn commented Feb 7, 2017

@newswim Nice find, I think 'encrypted environment variables not available to forks' seems reasonable, since my tests were passing locally.

I think what you added to the travis.yml file makes sense

@nelsonic
Copy link
Member

nelsonic commented Feb 8, 2017

@newswim you should have access to push your branch to this repo
and then open a new pull request to test that theory... 👍

})
t.end();
Copy link
Member

Choose a reason for hiding this comment

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

Same thing as below here.
You should leave the t.end inside of the email function

})
t.end()
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't put the t.end callback outside of the email function.
It will cause it to run immediately and not wait to test what is returned from the email function.

Copy link
Member

@samhstn samhstn left a comment

Choose a reason for hiding this comment

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

@newswim I'd say invoke the t.end inside the email callback from the comments above and remove the global environment variable from travis.yml, then I think it's good to merge 👍

@newswim
Copy link
Collaborator Author

newswim commented Feb 8, 2017

Thanks Sam, I'll initiate a new PR from the this repo rather than my fork. Feel free to close 🔚

@samhstn
Copy link
Member

samhstn commented Feb 8, 2017

Closing see #70 instead

@samhstn samhstn closed this Feb 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants