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

123
Vistas
How can I specify a float value for a test with this output?
describe('convert', () => {
  test
  .stdout()
  .command(['convert'])
  .it('runs convert', ctx => {
    expect(ctx.stdout).to.equal()
  })

  test
  .stdout()
  .command(['convert', '--amount', '50', '--from', 'EUR', '--to', 'USD'])
  .it('convert  --amount 50 --from EUR --to USD', ctx => {
    expect(ctx.stdout).to.contain('')
  })
})

Exit for function:

Example: 1.2345

I need to know how to make the test check the output knowing that the value is a float.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the end I used expect(typeof ctx.stdout === typeof 1.0) for the kind of response I was expecting. The code has been like this:

describe('convert', () => {
  test
  .stdout()
  .command(['convert'])
  .it('runs convert', ctx => {
    expect(typeof ctx.stdout === typeof 1.0)
  })

  test
  .stdout()
  .command(['convert', '--amount', '50', '--from', 'EUR', '--to', 'USD'])
  .it('convert  --amount 50 --from EUR --to USD', ctx => {
    expect(typeof ctx.stdout === typeof 1.0)
  })
})
about 4 years ago · Juan Pablo Isaza Denunciar
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