jest-extended icon indicating copy to clipboard operation
jest-extended copied to clipboard

Allow any iterable in toInclude*Members

Open bogdanb opened this issue 4 years ago • 2 comments

What

Modifies the three toInclude{All,Any,Some}Members matchers to also match on iterables.

Why

This is meant mostly for testing things that return Set and Map instances, but it’s generally useful for any Iterable.

Notes

I’m not sure exactly what’s wrong with the typing file, I get TS2304: Cannot find name 'Iterable'. errors.

Housekeeping

  • [x] Unit tests
  • [x] Documentation is up to date
  • [x] No additional lint warnings
  • [x] Typescript definitions are added/updated where relevant

bogdanb avatar Oct 30 '20 17:10 bogdanb

I’m not actually sure where to update the documentation. I updated the comments in the TypeScript definition file (to say Iterable instead of Array), but I’m not sure if there’s anything else to update.

The type definitions show errors, though, on the type of the argument (which can also be an Iterable, now), so maybe this also needs some config update to see the Iterable definition?

bogdanb avatar Nov 02 '20 07:11 bogdanb

I’m not actually sure where to update the documentation. I updated the comments in the TypeScript definition file (to say Iterable instead of Array), but I’m not sure if there’s anything else to update.

Could you update the docs? It currently says "Array", and maybe add an example using a Set?

SimenB avatar Oct 06 '21 11:10 SimenB