-
Notifications
You must be signed in to change notification settings - Fork 220
Codewars JavaScript Test Framework
DEPRECATED Do not use this for new kata. Use Mocha + Chai instead. See JavaScript Authoring doc, and JavaScript page.
describe("Example Tests", function() {
it("Example Test Case", function() {
Test.assertEquals(add(1, 1), 2, "optional message");
});
});
Checks that the actual value equals (===
) the expected value.
Checks that the actual value does not equal (!==
) the unexpected value.
Checks that the actual value equals (===
) the expected value.
Test.inspect
is used to wrap the values being tested,
allowing for similar values to be considered the same.
Checks that the actual value does not equal (!==
) the unexpected value.
Test.inspect
is used to wrap the values being tested,
allowing for similar values to be considered the same.
Checks that the actual value equals the expected value by performing deep comparison.
Unlike Test.assertSimilar
, values are not turned into strings.
Checks that the actual value does not equal the unexpected value by performing deep comparison.
Unlike Test.assertNotSimilar
, values are not turned into strings.
Compares two floating point values and checks whether they are approximately equal to each other.
Compares two floating point values and checks whether they are sufficiently different from each other.
Checks that the actual value contains the expected element.
Checks that the actual value does not contain the unexpected element.
Checks that fn
throws.
Checks that fn
does not throw.
Core assertion method testing if passed
is truthy.
Returns a string representation of the object.
Returns a shuffled array (new array).
Returns a random integer between 0-100 (inclusive).
Returns a random string of characters.
- Length range: between 1-9 (inclusive)
- Character range: digits (0-9) and lowercase letters (a-z)
Returns a single, randomly chosen item from an array.