must
Version:
Testing and assertion library with friendly BDD syntax — awesome.must.be.true(). Many expressive matchers and is test runner and framework agnostic. Follows RFC 2119 with its use of MUST. Good and well tested stuff.
38 lines (30 loc) • 978 B
JavaScript
var Must = require("../..")
var assert = require("./assert")
describe("Must.prototype.between", function() {
it("must fail if below", function() {
assert.fail(function() { Must(41).be.between(42, 69) })
})
it("must pass if on lower bound", function() {
assert.pass(function() { Must(42).be.between(42, 69) })
})
it("must pass if between", function() {
assert.pass(function() { Must(50).be.between(42, 69) })
})
it("must pass if on higher bound", function() {
assert.pass(function() { Must(69).be.between(42, 69) })
})
it("must fail if above", function() {
assert.fail(function() { Must(70).be.between(42, 69) })
})
require("./_assertion_error_test")(function() {
Must(13).be.between(42, 69)
}, {
actual: 13,
message: "13 must be between 42 and 69"
})
describe(".not", function() {
it("must invert the assertion", function() {
assert.fail(function() { Must(50).not.be.between(42, 69) })
})
})
})