From 923bc50e38ca58087080800dbb6f4e21b28460cf Mon Sep 17 00:00:00 2001 From: Dan Dascalescu Date: Tue, 19 Mar 2019 06:40:22 -0500 Subject: [PATCH] docs: toContain supports Sets as well (#8131) --- docs/UsingMatchers.md | 5 +++-- website/versioned_docs/version-22.x/UsingMatchers.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/UsingMatchers.md b/docs/UsingMatchers.md index bb21bb3fbd59..d6fab01b4dc9 100644 --- a/docs/UsingMatchers.md +++ b/docs/UsingMatchers.md @@ -117,9 +117,9 @@ test('but there is a "stop" in Christoph', () => { }); ``` -## Arrays +## Arrays and iterables -You can check if an array contains a particular item using `toContain`: +You can check if an array or iterable contains a particular item using `toContain`: ```js const shoppingList = [ @@ -132,6 +132,7 @@ const shoppingList = [ test('the shopping list has beer on it', () => { expect(shoppingList).toContain('beer'); + expect(new Set(shoppingList)).toContain('beer'); }); ``` diff --git a/website/versioned_docs/version-22.x/UsingMatchers.md b/website/versioned_docs/version-22.x/UsingMatchers.md index 87b15b921c6e..001537780915 100644 --- a/website/versioned_docs/version-22.x/UsingMatchers.md +++ b/website/versioned_docs/version-22.x/UsingMatchers.md @@ -118,9 +118,9 @@ test('but there is a "stop" in Christoph', () => { }); ``` -## Arrays +## Arrays and iterables -You can check if an array contains a particular item using `toContain`: +You can check if an array or iterable contains a particular item using `toContain`: ```js const shoppingList = [ @@ -133,6 +133,7 @@ const shoppingList = [ test('the shopping list has beer on it', () => { expect(shoppingList).toContain('beer'); + expect(new Set(shoppingList)).toContain('beer'); }); ```