Skip to content

Commit

Permalink
Merge patch commit
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Feb 11, 2024
2 parents 2544531 + b9fa978 commit e156678
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@jeremyckahn/farmhand",
"version": "1.18.9",
"version": "1.18.10",
"publishConfig": {
"access": "public"
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/CowCard/Subheader/Subheader.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Subheader = (
return (
<div {...{ className: 'Subheader' }}>
<Bloodline {...{ colorsInBloodline: cow.colorsInBloodline }} />
{isCowPurchased && (
{(isCowPurchased || cowIdOfferedForTrade) && (
<p>
{cow.daysOld} {cow.daysOld === 1 ? 'day' : 'days'} old
</p>
Expand Down
30 changes: 30 additions & 0 deletions src/components/CowCard/Subheader/Subheader.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,34 @@ describe('Subheader', () => {
expect(value).toBeInTheDocument()
})
})

describe('cow age display', () => {
const ageRegex = /days? old/
test('displays when purchased', () => {
render(<Subheader {...baseProps} isCowPurchased={true} />)

const age = screen.queryByText(ageRegex)
expect(age).not.toBeNull()
})

test('displays when offered as trade', () => {
render(
<Subheader
{...baseProps}
cowIdOfferedForTrade="1234"
isCowPurchased={false}
/>
)

const age = screen.queryByText(ageRegex)
expect(age).not.toBeNull()
})

test('hidden when unpurchased from shop', () => {
render(<Subheader {...baseProps} isCowPurchased={false} />)

const age = screen.queryByText(ageRegex)
expect(age).toBeNull()
})
})
})

0 comments on commit e156678

Please sign in to comment.