Skip to content

Commit

Permalink
test(unit): update specs of footer and app version
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasferreiralimax committed Jul 1, 2024
1 parent f89952c commit 1b061b1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 54 deletions.
29 changes: 0 additions & 29 deletions src/components/AppVersion/test.spec.js

This file was deleted.

27 changes: 27 additions & 0 deletions src/components/AppVersion/test.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { render, screen } from "@testing-library/react";

import pkg from "../../../package.json";

import AppVersion from ".";

const appVersion = pkg.version;
const reactVersion = pkg.dependencies.react.replace("^", "");

describe("Should render <AppVersion/>", () => {
beforeEach(() => {
render(<AppVersion />);
});
it("renders AppVersion", () => {
expect(screen.getByTestId("app-version")).toBeInTheDocument();
});
it("AppVersion validation version react-techs-logos", () => {
expect(screen.getByTestId("app-version").textContent).toBe(
`react-techs-logos ${appVersion}`
);
});
it("AppVersion validation version React", () => {
expect(screen.getByTestId("react-version").textContent).toBe(
`React ${reactVersion}`
);
});
});
25 changes: 0 additions & 25 deletions src/components/Footer/test.spec.js

This file was deleted.

23 changes: 23 additions & 0 deletions src/components/Footer/test.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { render, screen } from "@testing-library/react";

import AppFooter from ".";

import pkg from "../../../package.json";

const appVersion = pkg.version;
const reactVersion = pkg.dependencies.react.replace("^", "");

describe("Should render <AppFooter/>", () => {
it("renders footer with credits and link", () => {
render(<AppFooter />);

const title: any = screen.getByTestId("app-footer");

expect(title.querySelector("a").href).toBe(
"https://github.com/criar-art/react-techs-logos"
);
expect(title.querySelector("a").textContent).toBe(
`React ${reactVersion}react-techs-logos ${appVersion}@lucasferreiralimax`
);
});
});

0 comments on commit 1b061b1

Please sign in to comment.