diff --git a/src/components/CowCard/Subheader/Subheader.js b/src/components/CowCard/Subheader/Subheader.js index 548255161..4827f6937 100644 --- a/src/components/CowCard/Subheader/Subheader.js +++ b/src/components/CowCard/Subheader/Subheader.js @@ -106,7 +106,7 @@ const Subheader = ( return (
- {isCowPurchased && ( + {(isCowPurchased || cowIdOfferedForTrade) && (

{cow.daysOld} {cow.daysOld === 1 ? 'day' : 'days'} old

diff --git a/src/components/CowCard/Subheader/Subheader.test.js b/src/components/CowCard/Subheader/Subheader.test.js index f04dd7639..086796932 100644 --- a/src/components/CowCard/Subheader/Subheader.test.js +++ b/src/components/CowCard/Subheader/Subheader.test.js @@ -100,4 +100,34 @@ describe('Subheader', () => { expect(value).toBeInTheDocument() }) }) + + describe('cow age display', () => { + const ageRegex = /days? old/ + test('displays when purchased', () => { + render() + + const age = screen.queryByText(ageRegex) + expect(age).not.toBeNull() + }) + + test('displays when offered as trade', () => { + render( + + ) + + const age = screen.queryByText(ageRegex) + expect(age).not.toBeNull() + }) + + test('hidden when unpurchased from shop', () => { + render() + + const age = screen.queryByText(ageRegex) + expect(age).toBeNull() + }) + }) })