-
Notifications
You must be signed in to change notification settings - Fork 36
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
🧪 mocking in get-block #229
Conversation
import { mockOf } from '../mock-of'; | ||
import { hexToDecimal } from '../../../classes/utils/hex-to-decimal'; | ||
|
||
jest.mock('isomorphic-unfetch'); | ||
|
||
// RSK has 30 second block times so tests pass more often | ||
const rpcUrl = `https://public-node.rsk.co`; |
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.
Let's remove this line entirely @jtfirek
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.
By remove do you mean replace with const rpcUrl = rpcUrls.mainnet;
@dawsbot?. I thought that we need some rpcURL for testing the providers?
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.
When we're all done with our test changes with spys and mocks, all tests should work in an offline environment @jtfirek
]; | ||
omittableOther = [...typeCheckKeys]; | ||
} | ||
async function runTest(method: any, params: any[], responseIdentifier: string | number): Promise<void> { |
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.
Let's get rid of these any
s
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.
I fixed by adding an export from type from the library @dawsbot, but lmk if this is not allowing as I could also just define a simple type for this test I just thought that importing would be cleaner.
Mocking in
get-block.test.ts
and slight changes inget-transactions.test.ts
just to make tests consistent across files