expectOrderedItems()function

expectOrderedItems(items: Iterable<Item<I, T>>, keys: Iterable<string> & NotString): void
ParamType
itemsIterable<Item<I, T>>
The items to check, each carrying an .id prop. required
keysIterable<string> & NotString
The exact ordered sequence of .id values expected. required
Throws
Error
If the items' ids don't match keys in order.

Assert that a set of Item objects has exactly the expected .id values, in the exact given order.

  • Compares ids positionally, so order is significant.
  • On failure, rewrites the stack trace to point at the call site.

Examples

expectOrderedItems(results, ["person1", "person2"])