Test.ArrayAssert Class
+ + + + +The ArrayAssert object provides functions to test JavaScript array objects +for a variety of cases.
+Item Index
+ + +Methods
+ +-
+
+
- + _indexOf + + + + + +
- + _some + + + + + +
- + contains + + + static + + + + +
- + containsItems + + + static + + + + +
- + containsMatch + + + static + + + + +
- + doesNotContain + + + static + + + + +
- + doesNotContainItems + + + static + + + + +
- + doesNotContainMatch + + + static + + + + +
- + indexOf + + + static + + + + +
- + isEmpty + + + static + + + + +
- + isNotEmpty + + + static + + + + +
- + itemsAreEqual + + + static + + + + +
- + itemsAreEquivalent + + + static + + + + +
- + itemsAreSame + + + static + + + + +
- + lastIndexOf + + + static + + + + +
Methods
+ + +_indexOf
+
+
+ -
+
+
-
+
+
haystack+ +
+
+ -
+
+
needle+ +
+
+
Simple indexOf() implementation for an array. Defers to native +if available.
+Parameters:
+ +-
+
+
-
+
+
haystack+ Array + + + + +++ + +The array to search.
+
+
+ -
+
+
needle+ Variant + + + + +++ + +The value to locate.
+
+
+
Returns:
+ +_some
+
+
+ -
+
+
-
+
+
haystack+ +
+
+ -
+
+
matcher+ +
+
+
Simple some() implementation for an array. Defers to native +if available.
+Parameters:
+ + +Returns:
+ +contains
+
+
+ -
+
+
-
+
+
needle+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that a value is present in an array. This uses the triple equals +sign so no type coercion may occur.
+containsItems
+
+
+ -
+
+
-
+
+
needles+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that a set of values are present in an array. This uses the triple equals +sign so no type coercion may occur. For this assertion to pass, all values must +be found.
+containsMatch
+
+
+ -
+
+
-
+
+
matcher+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that a value matching some condition is present in an array. This uses +a function to determine a match.
+Parameters:
+ + +doesNotContain
+
+
+ -
+
+
-
+
+
needle+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that a value is not present in an array. This uses the triple equals +Asserts that a value is not present in an array. This uses the triple equals +sign so no type coercion may occur.
+doesNotContainItems
+
+
+ -
+
+
-
+
+
needles+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that a set of values are not present in an array. This uses the triple equals +sign so no type coercion may occur. For this assertion to pass, all values must +not be found.
+Parameters:
+ + +doesNotContainMatch
+
+
+ -
+
+
-
+
+
matcher+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
message+ +
+
+
Asserts that no values matching a condition are present in an array. This uses +a function to determine a match.
+Parameters:
+ + +indexOf
+
+
+ -
+
+
-
+
+
needle+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
index+ +
+
+ -
+
+
message+ +
+
+
Asserts that the given value is contained in an array at the specified index. +This uses the triple equals sign so no type coercion will occur.
+Parameters:
+ +-
+
+
-
+
+
needle+ Object + + + + +++ + +The value to look for.
+
+
+ -
+
+
haystack+ Array + + + + +++ + +The array to search in.
+
+
+ -
+
+
index+ Int + + + + +++ + +The index at which the value should exist.
+
+
+ -
+
+
message+ String + + + + +++ + +(Optional) The message to display if the assertion fails.
+
+
+
isEmpty
+
+
+ -
+
+
-
+
+
actual+ +
+
+ -
+
+
message+ +
+
+
Asserts that an array is empty.
+isNotEmpty
+
+
+ -
+
+
-
+
+
actual+ +
+
+ -
+
+
message+ +
+
+
Asserts that an array is not empty.
+itemsAreEqual
+
+
+ -
+
+
-
+
+
expected+ +
+
+ -
+
+
actual+ +
+
+ -
+
+
message+ +
+
+
Asserts that the values in an array are equal, and in the same position, +as values in another array. This uses the double equals sign +so type coercion may occur. Note that the array objects themselves +need not be the same for this test to pass.
+itemsAreEquivalent
+
+
+ -
+
+
-
+
+
expected+ +
+
+ -
+
+
actual+ +
+
+ -
+
+
comparator+ +
+
+ -
+
+
message+ +
+
+
Asserts that the values in an array are equivalent, and in the same position, +as values in another array. This uses a function to determine if the values +are equivalent. Note that the array objects themselves +need not be the same for this test to pass.
+Parameters:
+ +-
+
+
-
+
+
expected+ Array + + + + +++ + +An array of the expected values.
+
+
+ -
+
+
actual+ Array + + + + +++ + +Any array of the actual values.
+
+
+ -
+
+
comparator+ Function + + + + +++ + +A function that returns true if the values are equivalent + or false if not.
+
+
+ -
+
+
message+ String + + + + +++ + +(Optional) The message to display if the assertion fails.
+
+
+
Returns:
+ +itemsAreSame
+
+
+ -
+
+
-
+
+
expected+ +
+
+ -
+
+
actual+ +
+
+ -
+
+
message+ +
+
+
Asserts that the values in an array are the same, and in the same position, +as values in another array. This uses the triple equals sign +so no type coercion will occur. Note that the array objects themselves +need not be the same for this test to pass.
+lastIndexOf
+
+
+ -
+
+
-
+
+
needle+ +
+
+ -
+
+
haystack+ +
+
+ -
+
+
index+ +
+
+ -
+
+
message+ +
+
+
Asserts that the given value is contained in an array at the specified index, +starting from the back of the array. +This uses the triple equals sign so no type coercion will occur.
+Parameters:
+ +-
+
+
-
+
+
needle+ Object + + + + +++ + +The value to look for.
+
+
+ -
+
+
haystack+ Array + + + + +++ + +The array to search in.
+
+
+ -
+
+
index+ Int + + + + +++ + +The index at which the value should exist.
+
+
+ -
+
+
message+ String + + + + +++ + +(Optional) The message to display if the assertion fails.
+
+
+
