fraxken/IteratorMatcher

Add preserveExpectationOrder options on IteratorMatcherExecutorOptions

Closed this issue · 0 comments

Current implementation of execute method always preserve the expectation order. However we may want to execute without preserving the expectation order like in the following example:

function* dummyGen() {
  yield 5;
  yield "bar";
  yield "foo";
}

const result = new IteratorMatcher()
      .expect("foo")
      .expect("bar")
      .expect(5)
      .execute(dummyGen(), { preserveExpectationOrder: false });

This seems quite complicated to elaborate a solution to work for both scenarios.