-
Notifications
You must be signed in to change notification settings - Fork 473
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: mock data builder for tests #2675
Conversation
Branch preview✅ Deploy successful! https://poc_chain_builder--walletweb.review-wallet-web.5afe.dev |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
Coverage report
Show new covered files 🐣
Test suite run success961 tests passing in 133 suites. Report generated by 🧪jest coverage report action from 5a671c8 |
src/tests/builders/chains.ts
Outdated
.with('address', faker.finance.ethereumAddress()) | ||
.with('txHash', faker.string.hexadecimal()) | ||
.with('api', faker.internet.url({ appendSlash: false })) |
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 with
is extremely boilerplaity. Why can't it just be an object?
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.
It can. I've changed it to accept Partial<T>
instead.
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.
🦾
What it solves
Resolves brittle tests
How this PR fixes it
A new
Builder
class has been added that facilitates mock data generation for tests. An examplechainBuilder
has been created and used in a few demonstrative tests whereuseCurrentChain
is mocked.How to test it
Observe the tests passing.
Checklist