Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
mocking S3.listObjectsV2

I would want to moc the call function the call to s3.listObjectV2.

I am only in need of the contents of what's returned.

public async init() {
        AWS.config.update({
            region: config.aws.region,
        })

        const s3 = new AWS.S3({ apiVersion: config.aws.S3.apiVersion })

        let params = { Bucket: config.aws.S3.ctrPredictorModelBucket }
        const data = await s3.listObjectsV2(params).promise()
        return data.contents
}
            

Then in the test, I would want to do before every test something like

before( () => {

        s3 = mock.mock(AWS.S3)
        // request = mock.mock(AWS.Request)
        
        mock.when(s3.listObjectsV2(mock.anything()).thenReturn(Return_object))
         
    })

with Return_objecy only contains what is needed.

But the current way things are set I get an error saying the s3.listObjectsV2 is not a function

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda