From 2fa546ad8b92aa56ddd86d179d9775d49910f90e Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sat, 7 Dec 2024 15:18:01 +0800 Subject: [PATCH] test: update test case. --- test/run.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/run.test.js b/test/run.test.js index ad1c4942..4b2e9fcd 100644 --- a/test/run.test.js +++ b/test/run.test.js @@ -70,6 +70,21 @@ function __triggerKeyboardFocus(el, keyCode, opt) { el.dispatchEvent ? el.dispatchEvent(eventObj) : el.fireEvent('onfocus', eventObj); } +jest.mock('ws', () => { + return { + WebSocket: class { + constructor(url) { + this.url = url; + this.readyState = 1; + this.send = jest.fn(); + this.close = jest.fn(); + this.addEventListener = jest.fn(); + this.removeEventListener = jest.fn(); + } + } + }; +}); + beforeAll(async () => { browser = await puppeteer.launch({ args: ['--no-sandbox'] }); page = await browser.newPage();