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

129
Vistas
Jest + Typescript cannot mock AWS transcribe function

I've been trying to figure out how to implement the jest testing solution provided here (vanilla js) by the AWS team to work and so far I can't seem to make any headway. I get an error at .mockResolvedValue(expectedResult) as "Argument of type '{ isMock: boolean; }' is not assignable to parameter of type 'never'." However, I can't find a way to get around it. The function is cast above the describe block and follows the pattern shown at this StackOverflow post.

Any thoughts on what I'm doing wrong? I'm not super familiar with mocking like this so I could be missing something obvious. Also the pattern I have is pretty much the same as the code snippets AWS provides in the initial link.

transcribe client

import { TranscribeClient } from '@aws-sdk/client-transcribe';
const REGION = 'us-east-2';
// Create Transcribe service object.
export const transcribeClient = new TranscribeClient({ region: REGION });

transcribe test

import { createTranscribeJob } from './createJob';
import { transcribeClient } from '../../../../libs/transcribeClient';

jest.mock('../../../../libs/transcribeClient.ts');

const mockedTranscribeClient = transcribeClient as jest.Mocked<typeof transcribeClient>;

describe('@aws-sdk/client-transcribe mock', () => {
  it('should successfully mock Transcribe client', async () => {

    const expectedResult: { isMock: boolean } = { isMock: true };
    mockedTranscribeClient.send.mockResolvedValue(expectedResult);
    const response = await createTranscribeJob({
      TranscriptionJobName: 'testName',
      LanguageCode: 'en-US',
      MediaFormat: 'mp4',
      MediaUri: 'testUri',
    });

    expect(response.isMock).toEqual(true);

  });
});
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