diff --git a/package-lock.json b/package-lock.json index 077c7a161..d185418ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jeremyckahn/farmhand", - "version": "1.18.9", + "version": "1.18.10", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@jeremyckahn/farmhand", - "version": "1.18.9", + "version": "1.18.10", "license": "GPL-2.0-or-later", "dependencies": { "@emotion/react": "^11.11.1", diff --git a/package.json b/package.json index 2df4430a1..f2d94003e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jeremyckahn/farmhand", - "version": "1.18.9", + "version": "1.18.10", "publishConfig": { "access": "public" }, 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() + }) + }) })