Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

248
Views
Usando sinon con Args y luego intento hacer una restauración, obtengo TypeError: 'restaurar' no es una función

Si coloco mi función así:

 const sandbox: sinon.SinonSandbox = sinon.createSandbox(); getInfoStub = sandbox.stub(ytdl, 'getInfo').withArgs(videoUrl).resolves(videoInfo);

Y luego trato de hacer getInfoStub.restore() Obtengo un TypeError: getInfoStub.restore is not a function

Sin embargo, cuando elimino la opción .withArgs(videoUrl) restore funciona bien:

 const sandbox: sinon.SinonSandbox = sinon.createSandbox(); getInfoStub = sandbox.stub(ytdl, 'getInfo').resolves(videoInfo);

¿Cuál es el trato con withArgs que rompe sinon?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Pruebe el siguiente código:

 const getInfoStub = sandbox.stub(ytdl, 'getInfo'); const result = getInfoStub.withArgs(videoUrl).resolves(videoInfo); getInfoStub.restore();

Enlace de referencia: https://sinonjs.org/releases/latest/stubs/

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!