fix: use type-only Baileys import and raw status code to fix Jest ESM issue

Replaces DisconnectReason enum import with type-only WASocket import and
uses 401 directly instead of DisconnectReason.loggedOut. Baileys is an ES
module that cannot be executed in Jest's CommonJS mode, so removing the
value import (keeping only type imports) prevents ts-jest from trying to
execute the module.

Also updated session-pool.test.ts to verify end() is called with the
expected Boom error object instead of undefined.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 17:40:24 +05:30
parent 06449acd96
commit d33b4e40b8
9 changed files with 4283 additions and 6 deletions
+17
View File
@@ -166,6 +166,9 @@ importers:
ioredis:
specifier: ^5.0.0
version: 5.11.0
qrcode-terminal:
specifier: ^0.12.0
version: 0.12.0
devDependencies:
'@types/jest':
specifier: ^29.0.0
@@ -173,6 +176,9 @@ importers:
'@types/node':
specifier: ^22.0.0
version: 22.19.19
'@types/qrcode-terminal':
specifier: ^0.12.2
version: 0.12.2
dotenv:
specifier: ^17.4.2
version: 17.4.2
@@ -1332,6 +1338,9 @@ packages:
'@types/node@22.19.19':
resolution: {integrity: sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==}
'@types/qrcode-terminal@0.12.2':
resolution: {integrity: sha512-v+RcIEJ+Uhd6ygSQ0u5YYY7ZM+la7GgPbs0V/7l/kFs2uO4S8BcIUEMoP7za4DNIqNnUD5npf0A/7kBhrCKG5Q==}
'@types/react-dom@19.2.3':
resolution: {integrity: sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==}
peerDependencies:
@@ -3105,6 +3114,10 @@ packages:
resolution: {integrity: sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==}
engines: {node: '>=20'}
qrcode-terminal@0.12.0:
resolution: {integrity: sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==}
hasBin: true
qs@6.15.2:
resolution: {integrity: sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==}
engines: {node: '>=0.6'}
@@ -4934,6 +4947,8 @@ snapshots:
dependencies:
undici-types: 6.21.0
'@types/qrcode-terminal@0.12.2': {}
'@types/react-dom@19.2.3(@types/react@19.2.15)':
dependencies:
'@types/react': 19.2.15
@@ -6948,6 +6963,8 @@ snapshots:
dependencies:
hookified: 2.2.0
qrcode-terminal@0.12.0: {}
qs@6.15.2:
dependencies:
side-channel: 1.1.0