Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xotic750/assert-x
A Javascript assertion library.
https://github.com/xotic750/assert-x
assert browser ecmascript nodejs
Last synced: about 2 months ago
JSON representation
A Javascript assertion library.
- Host: GitHub
- URL: https://github.com/xotic750/assert-x
- Owner: Xotic750
- License: mit
- Created: 2013-12-20T02:08:05.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-07-03T16:14:28.000Z (over 1 year ago)
- Last Synced: 2024-10-13T14:29:15.760Z (3 months ago)
- Topics: assert, browser, ecmascript, nodejs
- Language: JavaScript
- Homepage:
- Size: 7.41 MB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## assert-x
A Javascript assertion library.
**See**: https://nodejs.org/dist/latest-v12.x/docs/api/assert.html
This is legacy mode by default.
**See**:https://nodejs.org/dist/latest-v12.x/docs/api/assert.html#assert_legacy_mode
- [assert-x](#module_assert-x)
- [~AssertionError](#module_assert-x.AssertionError) ⇐Error
- [`new AssertionError([message])`](#new_module_assert-x.AssertionError_new)
- [`~deepEqual`](#module_assert-x.deepEqual)
- [`~deepStrictEqual`](#module_assert-x.deepStrictEqual)
- [`~doesNotThrow`](#module_assert-x.doesNotThrow)
- [`~equal`](#module_assert-x.equal)
- [`~fail`](#module_assert-x.fail)
- [`~ifError`](#module_assert-x.ifError)
- [`~notDeepEqual`](#module_assert-x.notDeepEqual)
- [`~notDeepStrictEqual`](#module_assert-x.notDeepStrictEqual)
- [`~notEqual`](#module_assert-x.notEqual)
- [`~notStrictEqual`](#module_assert-x.notStrictEqual)
- [`~ok`](#module_assert-x.ok)
- [`~strictEqual`](#module_assert-x.strictEqual)
- [`~throws`](#module_assert-x.throws)
- [`~$assert(value, message)`](#module_assert-x.$assert)Strict mode is available.
**See**: https://nodejs.org/dist/latest-v12.x/docs/api/assert.html#assert_strict_mode
### assert-x~AssertionError ⇐
Error
**Kind**: inner class of [
assert-x
](#module_assert-x)
**Extends**:Error
#### `new AssertionError([message])`
Error constructor for test and validation frameworks that implement the
standardized AssertionError specification.| Param | Type | Description |
| --------- | ------------------- | -------------------------------- |
| [message] |Object
| Need to document the properties. |### `assert-x~deepEqual`
Tests for deep equality, coercive equality with the equal comparison
operator ( == ) and equivalent.**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~deepStrictEqual`
Tests for deep equality, coercive equality with the equal comparison
operator ( === ) and equivalent.**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~doesNotThrow`
Expects block not to throw an error, see assert~throws for details.
**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------------ | --------------------------------------------- |
| block |function
| The function block to be executed in testing. |
| [error] |constructor
| The comparator. |
| [message] |string
| Text description of test. |### `assert-x~equal`
Tests shallow, coercive equality with the equal comparison
operator ( == ).**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~fail`
Throws an exception that displays the values for actual and expected
separated by the provided operator.**Kind**: inner property of [
assert-x
](#module_assert-x)
**Throws**:-
Error
Throws an `AssertionError`.| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |
| operator |string
| The compare operator. |### `assert-x~ifError`
Tests if value is not a falsy value, throws if it is a truthy value.
Useful when testing the first argument, error in callbacks.**Kind**: inner property of [
assert-x
](#module_assert-x)
**Throws**:-
\*
The value `err` if truthy.| Param | Type | Description |
| ----- | --------------- | -------------------------------------- |
| err |\*
| The value to be tested for truthiness. |### `assert-x~notDeepEqual`
Tests for any deep inequality. Opposite of `deepEqual`.
**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~notDeepStrictEqual`
Tests for deep inequality. Opposite of `deepStrictEqual`.
**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~notEqual`
Tests shallow, coercive non-equality with the not equal comparison
operator ( != ).**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~notStrictEqual`
Tests strict non-equality, as determined by the strict not equal
operator ( !== ).**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~ok`
Tests if value is truthy, it is equivalent to
`equal(!!value, true, message)`.**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | ------------------------- |
| value |\*
| The value to be tested. |
| [message] |string
| Text description of test. |### `assert-x~strictEqual`
Tests strict equality, as determined by the strict equality
operator ( === ).**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------- | --------------------------------------------- |
| actual |\*
| The actual value to be tested. |
| expected |\*
| The expected value to compare against actual. |
| [message] |string
| Text description of test. |### `assert-x~throws`
Expects block to throw an error. `error` can be constructor, regexp or
validation function.**Kind**: inner property of [
assert-x
](#module_assert-x)| Param | Type | Description |
| --------- | ------------------------------------------------------------------------ | --------------------------------------------- |
| block |function
| The function block to be executed in testing. |
| [error] |constructor
\|RegExp
\|function
| The comparator. |
| [message] |string
| Text description of test. |### `assert-x~$assert(value, message)`
Tests if value is truthy, it is equivalent to `equal(!!value, true, message)`.
**Kind**: inner method of [
assert-x
](#module_assert-x)| Param | Type | Description |
| ------- | ------------------- | ------------------------- |
| value |\*
| The value to be tested. |
| message |string
| Text description of test. |