diff options
| author | Vincent LE GOFF <g_n_s@hotmail.fr> | 2019-03-18 16:08:01 +0100 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-03-18 11:08:01 -0400 |
| commit | 2e1ed890b85d4ecf1a6332cf2e0c121d5640b496 (patch) | |
| tree | 6675fa9c8ed42d3e2d85583f5be3ce6456f2af9c /testing/README.md | |
| parent | d1b0a1ef6c9cf0726687402bd12ce9ad4ead8424 (diff) | |
Documentation clean up (denoland/deno_std#288)
Original: https://github.com/denoland/deno_std/commit/b699fa67befaef4423f365e55eff0fec2e14def8
Diffstat (limited to 'testing/README.md')
| -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. |
