-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Haris Bikovic <[email protected]>
- Loading branch information
1 parent
0e07862
commit 1b45089
Showing
3 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
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,84 @@ | ||
/* | ||
This file is part of Edgehog. | ||
Copyright 2023 SECO Mind Srl | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { it, expect } from "vitest"; | ||
import { screen } from "@testing-library/react"; | ||
import { renderWithProviders } from "setupTests"; | ||
|
||
import Footer from "./Footer"; | ||
|
||
it("displays correct app name and app version", () => { | ||
renderWithProviders( | ||
<Footer | ||
appName="appName" | ||
appVersion="appVersion" | ||
homepageUrl="https://edgehog.io/" | ||
repoUrl="https://github.com/edgehog-device-manager/edgehog" | ||
issueTrackerUrl="https://github.com/edgehog-device-manager/edgehog/issues" | ||
/>, | ||
); | ||
|
||
const appNameElement = screen.getByText("appName"); | ||
const appVersionElement = screen.getByText("appName"); | ||
|
||
expect(appNameElement).toBeInTheDocument(); | ||
expect(appVersionElement).toBeInTheDocument(); | ||
}); | ||
|
||
it("app logo redirects to homepage", () => { | ||
renderWithProviders( | ||
<Footer | ||
appName="Edgehog" | ||
appVersion="v1.0" | ||
homepageUrl="https://edgehog.io/" | ||
repoUrl="https://github.com/edgehog-device-manager/edgehog" | ||
issueTrackerUrl="https://github.com/edgehog-device-manager/edgehog/issues" | ||
/>, | ||
); | ||
|
||
const appLogo = screen.getByAltText(/Logo/i); | ||
expect(appLogo).toHaveAttribute("src", "/src/assets/images/brand.png"); | ||
|
||
const homepageLink = screen.getByRole("link", { name: "Edgehog Logo" }); | ||
expect(homepageLink).toHaveAttribute("href", "https://edgehog.io/"); | ||
}); | ||
|
||
it("anchors redirect to correct links", () => { | ||
renderWithProviders( | ||
<Footer | ||
appName="appName" | ||
appVersion="appVersion" | ||
homepageUrl="https://edgehog.io/" | ||
repoUrl="https://github.com/edgehog-device-manager/edgehog" | ||
issueTrackerUrl="https://github.com/edgehog-device-manager/edgehog/issues" | ||
/>, | ||
); | ||
|
||
const repositoryLink = screen.getByRole("link", { name: "GitHub" }); | ||
const issuesLink = screen.getByRole("link", { name: "GitHub-Issues" }); | ||
expect(repositoryLink).toHaveAttribute( | ||
"href", | ||
"https://github.com/edgehog-device-manager/edgehog", | ||
); | ||
expect(issuesLink).toHaveAttribute( | ||
"href", | ||
"https://github.com/edgehog-device-manager/edgehog/issues", | ||
); | ||
}); |
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
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