mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
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
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { dateAgo, monthDayYearFormat, uploadedFromNow } from ".";
|
|
|
|
describe("date_format utilities", () => {
|
|
describe("uploadedFromNow util", () => {
|
|
it("returns an user friendly uploaded at message", () => {
|
|
const currentDate = new Date();
|
|
currentDate.setDate(currentDate.getDate() - 2);
|
|
const twoDaysAgo = currentDate.toISOString();
|
|
|
|
expect(uploadedFromNow(twoDaysAgo)).toEqual("Uploaded 2 days ago");
|
|
});
|
|
});
|
|
|
|
describe("monthDayYearFormat util", () => {
|
|
it("returns a date in the format of 'MonthName Date, Year' (e.g. January 01, 2024)", () => {
|
|
const date = "2024-11-29T00:00:00Z";
|
|
expect(monthDayYearFormat(date)).toEqual("November 29, 2024");
|
|
});
|
|
});
|
|
|
|
describe("dateAgo util", () => {
|
|
it("returns a user friendly date ago message from a date string", () => {
|
|
const currentDate = new Date();
|
|
currentDate.setDate(currentDate.getDate() - 2);
|
|
const twoDaysAgo = currentDate.toISOString();
|
|
|
|
expect(dateAgo(twoDaysAgo)).toEqual("2 days ago");
|
|
});
|
|
|
|
it("returns a user friendly date ago message from a Date object", () => {
|
|
const date = new Date();
|
|
date.setDate(date.getDate() - 2);
|
|
|
|
expect(dateAgo(date)).toEqual("2 days ago");
|
|
});
|
|
});
|
|
});
|