UNPKG

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.

41 lines (32 loc) 1.09 kB
var Must = require("../..") var assert = require("./assert") describe("Must.prototype.null", function() { it("must pass given null", function() { assert.pass(function() { Must(null).be.null() }) }) it("must fail given true primitive", function() { assert.fail(function() { Must(true).be.null() }) }) it("must fail given false primitive", function() { assert.fail(function() { Must(false).be.null() }) }) it("must fail given undefined", function() { assert.fail(function() { Must(undefined).be.null() }) }) it("must fail given empty string", function() { assert.fail(function() { Must("").be.null() }) }) it("must not do anything when not called as a function", function() { assert.pass(function() { void Must(null).be.null }) }) require("./_assertion_error_test")(function() { Must(true).be.null() }, { actual: true, expected: null, message: "true must be null" }) describe(".not", function() { it("must invert the assertion", function() { assert.fail(function() { Must(null).not.be.null() }) }) }) })