-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve test functionality - SALEOR_215 #5255
Conversation
🦋 Changeset detectedLatest commit: 2904632 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
OK, fix only the changeset
const calculateDiscountedPrice = ( | ||
undiscountedPrice: number, | ||
discountPercentage: number, | ||
): number => { | ||
return undiscountedPrice - (undiscountedPrice * discountPercentage) / 100; | ||
}; |
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.
This is dangerous: you just create a code to test the code. It implements the way discount is being calculated, meaning the test now is aware of it while it should not. Everywhere when possible make assertions on real values, because the incoming data is always known (you know what prices given product has because it's test data)
Non, blocking for now, but please keep in mind that.
.changeset/violet-laws-hang.md
Outdated
"saleor-dashboard": patch | ||
--- | ||
|
||
Improve inline discount test precision and reliability in draft orders |
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 write changeset where you clearly explain what you have improved. Something like
Now, test that checks discount calculation asserts against fixed precision (2 decimals)
0688cfc
* Improve test functionality * add changset * improved changeset * Add more details to changeset * remove unnecessery line * empty commit
* Improve test functionality * add changset * improved changeset * Add more details to changeset * remove unnecessery line * empty commit
What type of PR is this?
Related Issues or Documents
Usage Instructions, Screenshots, Recordings
Have you written tests?
[Optional] Description