@rbxts/expect > Placeholder > index
Placeholder.index property
A placeholder for array indices.
Signature:
index: string;
Remarks
Usually, indices are attached as metadata, but sometimes you might also want to show the index in your message.
That's where the index
placeholder comes into play.
Example
For example, lets say we were testing if two arrays are equal.
new ExpectMessageBuilder(
`Expected the array ${place.actual.value} to ${place.not} equal ${place.expected.value}`
).failureSuffix(`, but the ${place.index}nth element ${place.reason}`);
Which would result in the following output:
Expected the array [1,2,3] to equal [1,2,4], but the 3nth element had a different value