arrayContainOnly
.arrayContainOnly()
Asserts that an array contains only the specified elements (no extras, no missing). Sets evaluation.result with extra/missing arrays if the assertion fails.
Examples
Basic Usage
expect([1, 2, 3]).to.containOnly([1, 2, 3]);expect([1, 2, 3]).to.containOnly([3, 2, 1]);With Negation
expect([1, 2, 3, 4]).to.not.containOnly([1, 2, 3]);What Failures Look Like
When the assertion fails, you’ll see a clear error message:
// This would fail:expect([1, 2, 3, 4]).to.containOnly([1, 2, 3]);Modifiers
This assertion supports the following modifiers:
.not- Negates the assertion.to- Language chain (no effect).be- Language chain (no effect)