-
Notifications
You must be signed in to change notification settings - Fork 224
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
chore: add BillingService.ts test coverage #881
chore: add BillingService.ts test coverage #881
Conversation
b2e3734
to
0c265bd
Compare
91b0cca
to
d3bb9f2
Compare
This is ready for review @simlarsen, the build fails on the Probe service but probably #884 fixes that |
CommonServer/Utils/Errors.ts
Outdated
SUBSCRIPTION_NOT_FOUND: 'Subscription not found.', | ||
NO_PAYMENTS_METHODS: | ||
'No payment methods added. Please add your card to this project to change your plan', | ||
/// @dev consider consolidating the above and below error messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please consoliate this to: Payment Method not added. Please go to Project Settings > Billing and add a payment method.
@@ -0,0 +1,16 @@ | |||
import * as mock from 'jest-mock-extended'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pascal case this file
trialDate = OneUptimeDate.getSomeDaysAfter( | ||
data.plan.getTrialPeriod() | ||
); | ||
trialDate = data.trial |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use this condition in if else above
Common/Utils/Errors.ts
Outdated
@@ -0,0 +1,7 @@ | |||
export default { | |||
API: { | |||
CLIENT_SECRET_MISSING: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not move this to Errors file in CommonServer under BillingService?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an APIException
, I felt like it was better to put it in Common/Utils
, but happy to move that one as well as INVOICE_NOT_GENERATED
to CommonServer/Utils/Errors.ts
file.
What do you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets move it to CommonServer since they are related to Billing and are only used in CommonServer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
4df7acc
to
250653a
Compare
250653a
to
a52b2be
Compare
BillingService coverage
BillingService.ts
(95%)__mocks__
directory that would contain external libraries mocks (e.g Stripe)BillingService.ts
string errors to a separate Errors.ts filecollectCoverage: false
on jest config to improve test speedPull Request Checklist:
closes #XXXX
in your comment to auto-close the issue that your PR fixes (if such).Related Issue?
Screenshots (if appropriate):