Question

In my iced-coffee-script test I want to check that something is less than expected. The only library I found for this is assertthat:

assert = require 'node-assertthat'
assert.that (actualSeconds, is.atMost (expectedSeconds))

But my code cannot be compiled from iced-coffee-script to js:

error: unexpected ,
    assert.that (actualSeconds, is.atMost (expectedSeconds))

I guess it is because of is, that is key word in coffee-script. Yes, I know I can use assert.ok

assert = require 'assert'
assert.ok actualSeconds <= expectedSeconds

But in this case it don't show seconds on fail. It only show: fail: false == true

So how check that something is less than expected in iced-coffee-script test

Était-ce utile?

La solution

Even if I don't like to write pure js, I decided to create one module:

var assert = require ('node-assertthat')
module.exports = function (actual, expected) {
    assert.that (actual, is.atMost(expected))
}
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top