Skip to content
simple js framework to run unit tests/behaviors
JavaScript Shell
Find file
Latest commit bdabaa4 @valmont valmont Update README.markdown
Failed to load latest commit information.
jMoney added printSummart() function
lib adding new dirs
.gitignore Added .gitignore, update output to inclide spec name
README.markdown Update README.markdown
jmoney.tests.html updated readme to include info on creating custom predicates


Note: tests render in console. Best used with FF3+


  • toBe(value)

  • toBeTrue()

  • toBeNull()

  • toBeUndefined()

  • toMatch(regex)

  • toBeNumeric()

.not() can be prepended to any matcher.


Simple usage

when.('Using numbers', function() {
    spec('7 should be numberic').expect(7).toBeNumeric();

var returnSeven = function() {
    return 7;

when.('Using returnSeven', function() {
    spec('Should return 7').expect(returnSeven()).toBe(7);
    spec('Should return numeric value').expect(returnSeven()).toBeNumeric();

when('Using anonymous functions', function() {
    spec('Should return the number 7').expect(function() {
        return 7;


Creating your own matcher (predicate)

jn.Predicates.fn.toBeFoo = function(expected) {
    //expected can either be passed in as an argument i.e toBeFoo('this is the expected value');
    //Or can be explicitly set like so:
    this.expected = 'foo';
    return this.expected === this.actual; //this.actual is the returned value from the expect function

Using it

when('Using toBeFoo', function() {
    spec('Should be success when function returns foo').expect(function() {
        return 'foo';
Something went wrong with that request. Please try again.