new ArraySubject(failureStrategy, value)
Subject subclass which provides assertion methods for array types.
Parameters:
Name | Type | Description |
---|---|---|
failureStrategy |
FailureStrategy | The failure strategy to use when an assertion fails. |
value |
* | The value being checked. |
- Source:
Extends
- Subject
Methods
contains(element) → {ArraySubject}
Ensure that the array contains the given element.
Parameters:
Name | Type | Description |
---|---|---|
element |
* | The element that the value is expected to contain. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsAll(verb, testFn) → {ArraySubject}
Ensure that at all the elements of the array satisfy a test function.
Parameters:
Name | Type | Description |
---|---|---|
verb |
string | A description of the test, such as 'be even' or 'be prime'. |
testFn |
function | The test that elements must satisfy. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsAllIn(elements) → {InOrder}
Ensure that the array contains all of the elements specified.
Parameters:
Name | Type | Description |
---|---|---|
elements |
Iterable | Iterable which produces the elements that the array must contain. |
- Source:
Returns:
An InOrder object which allows the 'inOrder' assertion for the given elements.
- Type
- InOrder
containsAllOf(…elements) → {InOrder}
Ensure that the array contains all of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the array must contain. |
- Source:
Returns:
An InOrder object which allows the 'inOrder' assertion for the given elements
- Type
- InOrder
containsAny(verb, testFn) → {ArraySubject}
Ensure that at least one element of the array satisfies a test function.
Parameters:
Name | Type | Description |
---|---|---|
verb |
string | A description of the test, such as 'be even' or 'be prime'. |
testFn |
function | The test that elements must satisfy. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsAnyIn(elements) → {ArraySubject}
Ensure that the array contains any of the elements specified.
Parameters:
Name | Type | Description |
---|---|---|
elements |
Iterable | Iterable which produces the elements that the array must contain. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsAnyOf(…elements) → {ArraySubject}
Ensure that the array contains any of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the array must contain. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsExactly(…elements) → {InOrder}
Ensure that the array contains exactly the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the array must contain. |
- Source:
Returns:
An InOrder object which allows the 'inOrder' assertion for the given elements
- Type
- InOrder
containsExactlyIn(elements) → {InOrder}
Ensure that the array contains exactly the elements specified.
Parameters:
Name | Type | Description |
---|---|---|
elements |
Iterable | Iterable which produces the elements that the array must contain. |
- Source:
Returns:
An InOrder object which allows the 'inOrder' assertion for the given elements
- Type
- InOrder
containsNone(verb, testFn) → {ArraySubject}
Ensure that at none the elements of the array satisfy a test function.
Parameters:
Name | Type | Description |
---|---|---|
verb |
string | A description of the test, such as 'be even' or 'be prime'. |
testFn |
function | The test that elements must satisfy. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsNoneIn(elements) → {ArraySubject}
Ensure that the array contains none of the elements specified.
Parameters:
Name | Type | Description |
---|---|---|
elements |
Iterable | Iterable which produces the elements that the array must not contain. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
containsNoneOf(…elements) → {InOrder}
Ensure that the array contains none of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the array must not contain. |
- Source:
Returns:
An InOrder object which allows the 'inOrder' assertion for the given elements
- Type
- InOrder
doesNotContain(element) → {ArraySubject}
Ensure that the array does not contains the given element.
Parameters:
Name | Type | Description |
---|---|---|
element |
* | The element that the value is expected to contain. |
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
eachElement() → {EachSubject}
Causes any subsequent assertion methods to apply to each element of the array individually.
- Source:
Returns:
Fluent context that applies assertions to array elements.
- Type
- EachSubject
hasLength(length) → {Subject}
Ensure that the array has a length equal to the specified length.
Parameters:
Name | Type | Description |
---|---|---|
length |
number | The expected length. |
- Source:
Returns:
this
for chaining.
- Type
- Subject
isEmpty() → {ArraySubject}
Ensure that the array is empty.
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject
isNotEmpty() → {ArraySubject}
Ensure that the array is a not empty.
- Source:
Returns:
this
for chaining.
- Type
- ArraySubject