lib/common/test-case.jsx

Unit Test Framework for JSX

class TestCase

Base class for test cases

var verbose : boolean

new TestCase()

function setUp() : void

Set up for each test method.

function tearDown() : void

Tear down for each test method.

function beforeClass(tests : Array.<string>) : void

function afterClass() : void

function run(name : string, testFunction : function () : void) : void

function after(name : string) : void

function finish() : void

function async(testBody : function (:AsyncContext) : void, timeoutHandler : function (:AsyncContext) : void, timeoutMS : int) : void

Prepares an asynchronous test with timeout handler.

function async(testBody : function (:AsyncContext) : void, timeoutMS : int) : void

Prepares an asynchronous test. Automatically call this.fail() on timeout.

function expect(value : variant) : _Matcher

Creates a test matcher for a value.

Usage: this.expect(testingValue).toBe(expectedValue)

function expect(value : variant, message : string) : _Matcher

function pass(reason : string) : void

Tells a test passes.

function fail(reason : string) : void

Tells a test fails.

function equals(a : variant, b : variant) : boolean

function sortedKeys(map : Map.<variant>) : Array.<string>

function difflet(a : Array.<variant>, b : Array.<variant>) : string

function diag(message : string) : void

Shows diagnostic messages.

function note(message : string) : void

Shows notes.

override function toString() : string

class AsyncContext

new AsyncContext(test : TestCase, name : string, timeoutHandler : function (:AsyncContext) : void, timeoutMS : int)

function name() : string

function done() : void

class _Matcher

Test Assertion Executor

new _Matcher(test : TestCase, got : variant)

new _Matcher(test : TestCase, got : variant, name : string)

function toBe(x : variant) : void

function notToBe(x : variant) : void

function toBeLT(x : number) : void

function toBeLE(x : number) : void

function toBeGT(x : number) : void

function toBeGE(x : number) : void

function toMatch(x : RegExp) : void

function notToMatch(x : RegExp) : void

function toEqual(x : Array.<variant>) : void

Tests whether the given array equals to the expected.

function toEqual(x : Array.<string>) : void

function toEqual(x : Array.<number>) : void

function toEqual(x : Array.<int>) : void

function toEqual(x : Array.<boolean>) : void