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