new SetSubject(failureStrategy, value)
Subclass of Subject which provides assertions methods for Set types.
Parameters:
Name | Type | Description |
---|---|---|
failureStrategy |
FailureStrategy | The failure strategy to use when an assertion fails. |
value |
object | The value being checked. |
- Source:
Extends
- Subject
Methods
contains(value) → {SetSubject}
Ensure that the set contains a given item
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value expected to be in the set. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
containsAll(verb, testFn) → {SetSubject}
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
- SetSubject
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) → {SetSubject}
Ensure that the set contains all of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the set must contain. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
containsAny(verb, testFn) → {SetSubject}
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
- SetSubject
containsAnyIn(elements) → {SetSubject}
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
- SetSubject
containsAnyOf(…elements) → {SetSubject}
Ensure that the set contains any of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the set must contain. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
containsExactly(…elements) → {SetSubject}
Ensure that the set contains exactly the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the set must contain. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
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) → {SetSubject}
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
- SetSubject
containsNoneIn(elements) → {SetSubject}
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
- SetSubject
containsNoneOf(…elements) → {SetSubject}
Ensure that the set contains none of the elements specified.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
elements |
* |
<repeatable> |
The elements that the set must not contain. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
doesNotContain(value) → {SetSubject}
Ensure that the set does not contain a given item
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value not expected to be in the set. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
eachMember() → {EachSubject}
Causes any subsequent assertion methods to apply to each member of the set individually.
- Source:
Returns:
Fluent context that applies assertions to set members.
- Type
- EachSubject
hasSize(size) → {SetSubject}
Ensure that the set is the expected size.
Parameters:
Name | Type | Description |
---|---|---|
size |
number | The expected size of the set. |
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
isEmpty() → {SetSubject}
Ensure that the set is empty.
- Source:
Returns:
this
for chaining.
- Type
- SetSubject
isNotEmpty() → {SetSubject}
Ensure that the set is non-empty.
- Source:
Returns:
this
for chaining.
- Type
- SetSubject