diff options
Diffstat (limited to 'testing')
| -rw-r--r-- | testing/README.md | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/testing/README.md b/testing/README.md index 05cb8b92e..3d49c5a76 100644 --- a/testing/README.md +++ b/testing/README.md @@ -9,7 +9,7 @@ The module exports a `test` function which is the test harness in Deno. It accepts either a function (including async functions) or an object which contains a `name` property and a `fn` property. When running tests and outputting the results, the name of the past function is used, or if the -object is passed, the `name` property is used to identify the test. +object is passed, the `name` property is used to identify the test. If the assertion is false an `AssertionError` will be thrown. Asserts are exposed in `testing/asserts.ts` module. @@ -18,8 +18,13 @@ Asserts are exposed in `testing/asserts.ts` module. - `assert()` - Expects a boolean value, throws if the value is `false`. - `assertEquals()` - Uses the `equal` comparison and throws if the `actual` and `expected` are not equal. +- `assertNotEquals()` - Uses the `equal` comparison and throws if the `actual` and + `expected` are equal. - `assertStrictEq()` - Compares `actual` and `expected` strictly, therefore for non-primitives the values must reference the same instance. +- `assertStrContains()` - Make an assertion that `actual` contains `expected`. +- `assertMatch()` - Make an assertion that `actual` match RegExp `expected`. +- `assertArrayContains()` - Make an assertion that `actual` array contains the `expected` values. - `assertThrows()` - Expects the passed `fn` to throw. If `fn` does not throw, this function does. Also compares any errors thrown to an optional expected `Error` class and checks that the error `.message` includes an optional @@ -29,6 +34,8 @@ Asserts are exposed in `testing/asserts.ts` module. function will throw asynchronously. Also compares any errors thrown to an optional expected `Error` class and checks that the error `.message` includes an optional string. +- `unimplemented()` - Use this to stub out methods that will throw when invoked +- `unreachable()` - Used to assert unreachable code `runTests()` executes the declared tests. |
