fleet/frontend/components/Avatar/Avatar.tests.tsx
Gabriel Hernandez cdefa0c9e9
Chore rework UI activities (#25539)
For #23912

new UI for activities on the global, past, and upcoming feeds. These are
the same changes in [this
PR](https://github.com/fleetdm/fleet/pull/25329), except we are
reverting the changes around fleet initiated activities as that is not
in the current activities API.

We are doing this so that the new activities can go out in a release
while the backend is still being built and will be ready later.

> NOTE: this does contain the code for cancel activity functionality but
it hidden from the user.

- [x] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
- [x] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-01-20 10:39:46 +00:00

21 lines
668 B
TypeScript

import React from "react";
import { render, screen } from "@testing-library/react";
import Avatar from "./Avatar";
describe("Avatar - component", () => {
it("renders the user gravatar if provided", () => {
render(
<Avatar user={{ gravatar_url: "https://example.com/avatar.png" }} />
);
const avatar = screen.getByAltText("User avatar");
expect(avatar).toBeVisible();
expect(avatar).toHaveAttribute("src", "https://example.com/avatar.png");
});
it("renders the fleet avatar if useFleetAvatar is `true`", () => {
render(<Avatar useFleetAvatar user={{}} />);
expect(screen.getByTestId("fleet-avatar")).toBeVisible();
});
});