Skip to content
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

Merged
merged 3 commits into from
May 12, 2023
Merged

Conversation

jtfirek
Copy link
Collaborator

@jtfirek jtfirek commented May 9, 2023

Mocking in get-block.test.ts and slight changes in get-transactions.test.ts just to make tests consistent across files

@jtfirek jtfirek marked this pull request as draft May 9, 2023 20:53
@jtfirek jtfirek marked this pull request as ready for review May 9, 2023 22:38
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`;
Copy link
Owner

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

Copy link
Collaborator Author

@jtfirek jtfirek May 10, 2023

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?

Copy link
Owner

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> {
Copy link
Owner

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 anys

Copy link
Collaborator Author

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.

@dawsbot dawsbot merged commit f1ca49b into dawsbot:master May 12, 2023
1 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants