diff --git a/src/__tests__/__snapshots__/render.test.js.snap b/src/__tests__/__snapshots__/render.test.js.snap index 55a88ffb7..5fb44fae6 100644 --- a/src/__tests__/__snapshots__/render.test.js.snap +++ b/src/__tests__/__snapshots__/render.test.js.snap @@ -56,6 +56,12 @@ exports[`debug 1`] = ` > Second Text + + multiple + + + multiple + 0 @@ -118,6 +124,12 @@ exports[`debug changing component: bananaFresh button message should now be "fre > Second Text + + multiple + + + multiple + 0 @@ -166,6 +178,12 @@ exports[`debug: shallow 1`] = ` > Second Text + + multiple + + + multiple + 0 @@ -216,6 +234,12 @@ exports[`debug: shallow with message 1`] = ` > Second Text + + multiple + + + multiple + 0 @@ -280,6 +304,12 @@ exports[`debug: with message 1`] = ` > Second Text + + multiple + + + multiple + 0 diff --git a/src/__tests__/render.test.js b/src/__tests__/render.test.js index d7d4a0b2e..b471762a6 100644 --- a/src/__tests__/render.test.js +++ b/src/__tests__/render.test.js @@ -1,6 +1,7 @@ // @flow import React from 'react'; import { + Button, View, Text, TextInput, @@ -73,6 +74,8 @@ class Banana extends React.Component { First Text Second Text + multiple + multiple {test} ); @@ -133,6 +136,9 @@ test('getByText, queryByText', () => { expect(sameButton.props.children).toBe('not fresh'); expect(() => getByText('InExistent')).toThrow('No instances found'); + expect(() => getByText('multiple')).toThrow( + 'Expected 1 but found 2 instances' + ); const zeroText = getByText('0'); @@ -165,6 +171,103 @@ test('getByText, queryByText with children as Array', () => { ]); }); +const MyText = (props) => ; + +const Component = () => { + return ( + +