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

130
Views
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 answers
Answer question

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 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!