generated from NYCPlanning/ae-remix-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5d08853
commit 5010016
Showing
2 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
app/components/CapitalCommitmentsTable/CapitalCommitmentsTable.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { | ||
CapitalCommitment, | ||
CapitalCommitmentType, | ||
createCapitalCommitment, | ||
createCapitalCommitmentType, | ||
} from "~/gen"; | ||
import { CapitalCommitmentsTable } from "./CapitalCommitmentsTable"; | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
describe("CapitalCommitmentsTable", () => { | ||
let capitalCommitments: Array<CapitalCommitment> = []; | ||
let capitalCommitmentTypes: Array<CapitalCommitmentType> = []; | ||
beforeAll(() => { | ||
capitalCommitments = Array.from(Array(1), () => | ||
createCapitalCommitment({ | ||
type: "CONS", | ||
plannedDate: `${new Date("April 2024")}`, | ||
totalValue: 1e6, | ||
}), | ||
); | ||
capitalCommitmentTypes = Array.from(Array(1), () => | ||
createCapitalCommitmentType({ | ||
code: "CONS", | ||
description: "CONSTRUCTION", | ||
}), | ||
); | ||
}); | ||
|
||
it("should render the table header", () => { | ||
render( | ||
<CapitalCommitmentsTable | ||
capitalCommitments={capitalCommitments} | ||
capitalCommitmentTypes={capitalCommitmentTypes} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText(/Date/)).toBeVisible(); | ||
expect(screen.getByText(/Description/)).toBeVisible(); | ||
expect(screen.getByText(/Commitment/)).toBeVisible(); | ||
}); | ||
|
||
it("should render the month and year of the commitment", () => { | ||
render( | ||
<CapitalCommitmentsTable | ||
capitalCommitments={capitalCommitments} | ||
capitalCommitmentTypes={capitalCommitmentTypes} | ||
/>, | ||
); | ||
expect(screen.getByText(/Apr 2024/)).toBeVisible(); | ||
}); | ||
|
||
it("should render the description of the commitment type", () => { | ||
render( | ||
<CapitalCommitmentsTable | ||
capitalCommitments={capitalCommitments} | ||
capitalCommitmentTypes={capitalCommitmentTypes} | ||
/>, | ||
); | ||
expect(screen.getByText(/CONSTRUCTION/)).toBeVisible(); | ||
}); | ||
|
||
it("should render the value of the commitment", () => { | ||
render( | ||
<CapitalCommitmentsTable | ||
capitalCommitments={capitalCommitments} | ||
capitalCommitmentTypes={capitalCommitmentTypes} | ||
/>, | ||
); | ||
|
||
expect(screen.getByText(/\$1.00M/)).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters