-
-
Save fgm/8075e9e249d453d8601b to your computer and use it in GitHub Desktop.
Meteor tinytest api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From 1.1.03 packages/tinytest/tinytest.js | |
test._stringEqual(actual, expected, message) // Source comment: EXPERIMENTAL nicer (multiline) string display in runner | |
test.equal(actual, expected, message, not) // Source comment: "XXX eliminate 'message' and 'not' arguments" | |
/* Call this to fail the test with an exception. Use this to record exceptions | |
* that occur inside asynchronous callbacks in tests. It should only be used | |
* with asynchronous tests, and if you call this function, you should make | |
* sure that | |
* (1) the test doesn't call its callback (onComplete function); | |
* (2) the test function doesn't directly raise an exception. | |
*/ | |
test.exception(exception) // Only use with async tests, and read the source commments. | |
test.expect_fail() | |
test.fail(doc) | |
test.include(s, v, message, not) | |
test.instanceOf(obj, klass, message) | |
test.isFalse(v, msg) | |
test.isNaN(v, msg) | |
test.isNotNaN(v, msg) | |
test.isNotNull(v, msg) | |
test.isNotUndefined(v, msg) | |
test.isNull(v, msg) | |
test.isTrue(v, msg) | |
test.isUndefined(v, msg) | |
test.length(obj, expected_length, msg) // Source comment: should change to lengthOf to match vowsjs | |
test.matches(actual, regexp, message) | |
test.notEqual(actual, expected, message) | |
test.notInclude(s, v, message) | |
test.notInstanceOf(obj, klass, message) | |
test.notMatches(actual, regexp, message) | |
test.ok(doc) | |
test.runId() // Returns a unique test run id for convenience use by tests | |
/* Expected can be | |
* - undefined: accept any exception | |
* - string: pass if string is a substring ot the exception message | |
* - regexp: pass if the exception message matches the regexp | |
* - function: call the function as a predicate with the expression | |
*/ | |
test.throws(f, expected) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment