.beSorted()
Asserts that an array is sorted in ascending order. Each element must be less than or equal to the next element.
Examples
expect([1, 2, 3, 4, 5]).to.beSorted();expect(["a", "b", "c"]).to.beSorted();With Negation
expect([3, 1, 2]).to.not.beSorted();expect([5, 4, 3, 2, 1]).to.not.beSorted();What Failures Look Like
expect([3, 1, 2]).to.beSorted();ASSERTION FAILED: [3, 1, 2] should be sorted.OPERATION: beSorted
ACTUAL: <int[]> [3, 1, 2]EXPECTED: sorted in ascending order