Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevcs committed Aug 19, 2024
1 parent a16d263 commit c3f99a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/web3-rpc-providers/test/unit/constructor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/
/* eslint-disable max-classes-per-file */


import HttpProvider from 'web3-providers-http';
import WebSocketProvider from 'web3-providers-ws';
Expand All @@ -28,13 +28,15 @@ jest.mock('isomorphic-ws', () => {
return {
__esModule: true,
default: jest.fn().mockImplementation(() => {
// eslint-disable-next-line @typescript-eslint/ban-types
const eventListeners: { [key: string]: Function[] } = {};

return {
addEventListener: jest.fn((event, handler) => {
if (!eventListeners[event]) {
eventListeners[event] = [];
}
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
eventListeners[event].push(handler);
}),
removeEventListener: jest.fn((event, handler) => {
Expand All @@ -45,6 +47,7 @@ jest.mock('isomorphic-ws', () => {
dispatchEvent: jest.fn((event) => {
const eventType = event.type;
if (eventListeners[eventType]) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
eventListeners[eventType].forEach(handler => handler(event));
}
}),
Expand Down Expand Up @@ -93,4 +96,3 @@ describe('Web3ExternalProvider', () => {
});

});
/* eslint-enable max-classes-per-file */

0 comments on commit c3f99a0

Please sign in to comment.