Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

276
Vistas
TypeError: WalletLib.WalletClient is not a constructor

I'm using a custome SDK in my React Native project and importing it as:

import * as WalletLib from 'wallet-lib';

and then using its sub classes and function like below:

const client = new WalletLib.WalletClient(
  'http://dev-s-wallet.bgdom.com/',
  'https://dev-a-wallet.bgdom.com/',
);

This is working fine for application but when I write test using jest it gives me errors.

Test suite failed to run

TypeError: BoaWallet.WalletClient is not a constructor

   8 | import * as WalletLib from 'wallet-lib';
   9 |
> 10 | const boa_client = new WalletLib.WalletClient(
     |                    ^
  11 |   'http://dev-s-wallet.bgdom.com/',
  12 |   'http://dev-a-wallet.bgdom.com/',
  13 | );

  at Object.<anonymous> (src/utils/bWalletLibCall.js:10:20)
  at Object.<anonymous> (src/screens/authenticated/overviewTabs/PendingTab.js:27:1)

I'm mocking it as below:

jest.mock('wallet-lib', () => {
  return {
    WalletLib: jest.fn().mockImplementation(() => ({
      WalletClient: jest.fn().mockImplementation(() => {
        return {};
      }),
    })),
  };
});

But it still giving me same error. How can I resolve this.

Thank you!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda