Skip to content

Commit

Permalink
fix detail test
Browse files Browse the repository at this point in the history
  • Loading branch information
donywang922 committed Nov 24, 2023
1 parent f70778e commit d8eec59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/detail/[name]/__tests__/Detail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ global.fetch = jest.fn(() => {
}
return Promise.resolve({
ok: true,
json: () => Promise.resolve({data: [tmp]}),
json: () => Promise.resolve(tmp),
})
}
);
Expand Down
13 changes: 7 additions & 6 deletions app/detail/[name]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function Page({params}: {
.then(res => res.json())
.then(data => {
let tdata: perenual_detail = data
if (tdata.id) {
if (tdata.id != null) {
tmp = {
common_name: tdata.common_name,
cycle: tdata.cycle,
Expand Down Expand Up @@ -138,12 +138,12 @@ export default function Page({params}: {
<main className="container py-5">
{plantDetail.poisonous_to_humans === 1 && (
<div className="alert alert-danger d-flex align-items-center" role="alert" id={styles.warningtop}>
<Image height={50}src={warningIcon} alt="Warning" className="bi flex-shrink-0 me-2" />
<Image height={50} src={warningIcon} alt="Warning" className="bi flex-shrink-0 me-2"/>

<p className="mb-0 flex-grow-1 text-center">
WARNING! This plant is poisonous to humans, keep your distance.
</p>

</div>
)}
<div className="row">
Expand All @@ -161,7 +161,8 @@ export default function Page({params}: {
<PlantDesc d={plantDetail}/>
<div className="row justify-content-center py-3">
<div className="col col-auto">
<Link className="btn btn-light border border-secondary" href={`/detail/${plantDetail.id}/filter`}>
<Link className="btn btn-light border border-secondary"
href={`/detail/${plantDetail.id}/filter`}>
View More&gt;&gt;&gt;
</Link>
</div>
Expand All @@ -170,5 +171,5 @@ export default function Page({params}: {
</div>
</main>
);

}

0 comments on commit d8eec59

Please sign in to comment.