-
Notifications
You must be signed in to change notification settings - Fork 63
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
[historical] throw error if given a string for period{1,2} that is invalid input for new Date() #460
Conversation
…valid input for new Date()
Codecov Report
@@ Coverage Diff @@
## devel #460 +/- ##
==========================================
- Coverage 97.92% 97.73% -0.20%
==========================================
Files 22 22
Lines 482 485 +3
Branches 158 159 +1
==========================================
+ Hits 472 474 +2
- Misses 10 11 +1
Continue to review full report at Codecov.
|
Hey @glaucoheitor, awesome work! Thanks for stepping up 🙌 It's really great for maintainers when users are contributing back and this is greatly appreciated 😁 Yes, I was also thinking of using I have two minor comments which I'll place inline. And no problem re the test, I'll do that after we merge and I think it will make a lot of sense to you once you see it :D Thanks again! |
I'm glad to help @gadicc. I really like this project and makes me happy to be able to help just a lil bit. Thanks for the opportunity and your patience. |
Awesome, thanks @glaucoheitor! For sure, and all help is super appreciated, so thanks again! This will be in the next release. There'll be an automated message here when it gets published. I'll also tag this PR when I add the test for the new code path. 🎉🙏 |
@glaucoheitor, quoting from above commit: describe("historical", () => {
// ...
it("throws if period{1,2} gets an invalid string for new Date()", async () => {
await expect(yf.historical("TSLA", { period1: "invalid" })).rejects.toThrow(
/invalid date provided/
);
await expect(
yf.historical("TSLA", { period1: "2022-02-022", period2: "invalid" })
).rejects.toThrow(/invalid date provided/);
});
//...
}); So, we:
Hope that helps :) If you want to familiarize yourself further, you pull in the latest devel (with the tests above), run |
🎉 This PR is included in version 2.3.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #457 .
Changes
Type
Comments/notes
First time submitting a 'real' pull request with code. I didn't add tests because I'm not familiar with it.
Also, I'm not 100% sure if my change is the best decision for this issue, but I try a few different options and I liked this the most. Please let me know if I can improve this further and if I made something wrong so I can improve next time. Thanks for the amazing project, as always! :)