Skip to content

Commit

Permalink
test: fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Campos committed Jul 4, 2024
1 parent 13fccd4 commit 4ceab66
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const rows: RecentOpening[] = [{
cutBlock: '1',
grossAreaHa: 1,
statusDesc: 'Approved',
categoryDesc: 'Another',
categoryDesc: 'Another:Another',
disturbanceStart: '1',
entryTimestamp: '1',
updateTimestamp: '1',
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/BCHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const BCHeader: React.FC = () => {
<HeaderContainer
render={({ isSideNavExpanded, onClickSideNavExpand }: HeaderContainerProps) => (
<Header aria-label="React TS Carbon QuickStart"
className="spar-header"
data-testid="header">
className="spar-header"
data-testid="bc-header__header">
<SkipToContent />
<HeaderMenuButton
aria-label={isSideNavExpanded ? 'Close menu' : 'Open menu'}
Expand Down
18 changes: 16 additions & 2 deletions frontend/src/components/MyRecentActions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,22 @@ const MyRecentActions: React.FC = () => {
<div className="recent-actions">
<Tabs>
<TabList activation="manual" aria-label="List of tabs">
<Tab><div className="tab-header-recent">Recent</div></Tab>
<Tab><div className="tab-header-recent">Files and Docs</div></Tab>
<Tab>
<div
className="tab-header-recent"
data-testid={"my-recent-actions__recent-tab-header"}
>
Recent
</div>
</Tab>
<Tab>
<div
className="tab-header-recent"
data-testid={"my-recent-actions__files-tab-header"}
>
Files and Docs
</div>
</Tab>
</TabList>
<TabPanels>
<TabPanel className="tab-content">
Expand Down
6 changes: 1 addition & 5 deletions frontend/src/components/OpeningScreenDataTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ const OpeningScreenDataTable: React.FC<IOpeningScreenDataTable> = ({
size="md"
/>
</>
)
: cell.info.header === "category" ?(
cell.value.split(':')[0]
)
: (
) : (
cell.value
)}
</TableCell>
Expand Down
25 changes: 22 additions & 3 deletions frontend/src/services/OpeningService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ import { RecentOpening } from '../types/RecentOpening';

const backendUrl = env.VITE_BACKEND_URL;

interface statusCategory {
code: string;
description: string;
}

interface RecentOpeningApi {
openingId: number;
fileId: string;
cuttingPermit: string | null;
timberMark: string | null;
cutBlock: string | null;
grossAreaHa: number | null;
status: statusCategory | null;
category: statusCategory | null;
disturbanceStart: string | null;
entryTimestamp: string | null;
updateTimestamp: string | null;
}

/**
* Fetch recent openings data from backend.
*
Expand All @@ -26,16 +45,16 @@ export async function fetchRecentOpenings(): Promise<RecentOpening[]> {

if (data.data) {
// Extracting row information from the fetched data
const rows: RecentOpening[] = data.data.map((opening: RecentOpening) => ({
const rows: RecentOpening[] = data.data.map((opening: RecentOpeningApi) => ({
id: opening.openingId.toString(),
openingId: opening.openingId.toString(),
fileId: opening.fileId ? opening.fileId : '-',
cuttingPermit: opening.cuttingPermit ? opening.cuttingPermit : '-',
timberMark: opening.timberMark ? opening.timberMark : '-',
cutBlock: opening.cutBlock ? opening.cutBlock : '-',
grossAreaHa: opening.grossAreaHa ? opening.grossAreaHa.toString() : '-',
status: opening.statusDesc ? opening.statusDesc : '-',
category: opening.categoryDesc ? opening.categoryDesc : '-',
status: opening.status && opening.status.description? opening.status.description : '-',
category: opening.category && opening.category.description? opening.category.description : '-',
disturbanceStart: opening.disturbanceStart ? opening.disturbanceStart : '-',
entryTimestamp: opening.entryTimestamp ? opening.entryTimestamp.split('T')[0] : '-',
updateTimestamp: opening.updateTimestamp ? opening.updateTimestamp.split('T')[0] : '-'
Expand Down

0 comments on commit 4ceab66

Please sign in to comment.