Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces unit tests for the wrapSignAndBroadcastForSafe function and refactors the sendViaDirectEoa implementation. The refactor removes the logic for waiting for transaction receipts and simplifies the viem imports. A review comment suggests improving test robustness by resetting the window.ethereum global in the beforeEach block to prevent potential state leakage between tests.
| beforeEach(() => { | ||
| vi.clearAllMocks(); | ||
| Object.defineProperty(window, 'parent', { | ||
| configurable: true, | ||
| value: originalParent, | ||
| }); | ||
| }); |
There was a problem hiding this comment.
The beforeEach block resets window.parent but does not reset window.ethereum. While afterEach handles the cleanup, it is generally safer to ensure a clean state for every test by resetting all global mocks and properties in beforeEach as well, to prevent potential state leakage between tests if an afterEach fails or during parallel execution.
beforeEach(() => {
vi.clearAllMocks();
Object.defineProperty(window, 'parent', {
configurable: true,
value: originalParent,
});
Object.defineProperty(window, 'ethereum', {
configurable: true,
value: originalEthereum,
});
});
Summary
Validation