Skip to content

Commit

Permalink
Get copyright year dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
VictoriaBeilsten-Edmands committed Jan 2, 2025
1 parent f306d08 commit c41108b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Footer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ describe("Footer", () => {

test("Should render copyright only", async () => {
const copyrightText = "add text here";
const currentYear = new Date().getFullYear();
render(<Footer logo={null} copyright={copyrightText} />);

await waitFor(() => {
expect(screen.queryByRole("paragraph")).toBeInTheDocument();
expect(screen.queryByRole("paragraph")?.textContent).toStrictEqual(
`Copyright © 2024 ${copyrightText}`
`Copyright © ${currentYear} ${copyrightText}`,
);
// No logo
expect(screen.queryByRole("img")).not.toBeTruthy();
Expand All @@ -31,13 +32,14 @@ describe("Footer", () => {

test("Should render logo and copyright", async () => {
const copyrightText = "add text here";
const currentYear = new Date().getFullYear();
render(<Footer logo={dlsLogo} copyright={copyrightText} />);

await waitFor(() => {
expect(screen.getByRole("img")).toBeInTheDocument();
expect(screen.queryByRole("paragraph")).toBeInTheDocument();
expect(screen.queryByRole("paragraph")?.textContent).toStrictEqual(
`Copyright © 2024 ${copyrightText}`
`Copyright © ${currentYear} ${copyrightText}`,
);
});
});
Expand Down

0 comments on commit c41108b

Please sign in to comment.