Cosmic Docs

Theme
cs.test

Testing

The testing API is only avaiable when using the test runner.

cs.test.create name: string, callback: function )

Creates a test to be run. If the callback is async the test will be run concurrently.

cs.test.createIsolated name: string, callback: function )

Creates an isolated test to be run. An isolated test runs after all normal tests and are run one by one even if they are async.

cs.test.eq act: any, exp: any )

Asserts that the actual value equals the expected value.

cs.test.neq act: any, exp: any )

Asserts that the actual value does not equal the expected value.

cs.test.contains act: any, needle: any )

Asserts that the actual value contains a sub value. For a string, a sub value is a substring.

cs.test.throws func: function, expErrorSubStr: ?string )

Asserts that the anonymous function throws an exception. An optional substring can be provided to check against the exception message.