Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

simple js framework to run unit tests/behaviors

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 .nuget
Octocat-spinner-32 jMoney
Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.markdown
Octocat-spinner-32 jmoney.tests.html
Octocat-spinner-32 minme.bat

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.