From 57789134b208eedc98d2ab247c28b7cebe013012 Mon Sep 17 00:00:00 2001 From: Ben McCormick Date: Sun, 20 Aug 2017 16:36:49 -0400 Subject: [PATCH] Clarify what objects toContain and toContainEqual can be used on (#4307) This is just a documentation change to clarify that `toContain` and `toContainEqual` matchers work on arrays and strings (but not objects) rather than the more ambiguous "list". This also adds consistency, since all other api method docs refer to "arrays", rather than "lists". --- docs/en/ExpectAPI.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/en/ExpectAPI.md b/docs/en/ExpectAPI.md index 410175591253..1cfec4c90727 100644 --- a/docs/en/ExpectAPI.md +++ b/docs/en/ExpectAPI.md @@ -618,9 +618,9 @@ You could write `expect(bestDrinkForFlavor('octopus')).toBe(undefined)`, but it' ### `.toContain(item)` -Use `.toContain` when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. +Use `.toContain` when you want to check that an item is in an array. For testing the items in the array, this uses `===`, a strict equality check. `.toContain` can also check whether a string is a substring of another string. -For example, if `getAllFlavors()` returns a list of flavors and you want to be sure that `lime` is in there, you can write: +For example, if `getAllFlavors()` returns an array of flavors and you want to be sure that `lime` is in there, you can write: ```js test('the flavor list contains lime', () => { @@ -630,8 +630,8 @@ test('the flavor list contains lime', () => { ### `.toContainEqual(item)` -Use `.toContainEqual` when you want to check that an item is in a list. -For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. +Use `.toContainEqual` when you want to check that an item with a specific structure and values is contained in an array. +For testing the items in the array, this matcher recursively checks the equality of all fields, rather than checking for object identity. ```js describe('my beverage', () => {