Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { render } from "@testing-library/react";
|
||||
import React from "react";
|
||||
import DateCell from "./DateCell";
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
i18n: { language: "en" },
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("DateCell", () => {
|
||||
it("renders date with default displays", () => {
|
||||
const date = new Date(Date.now() - 60 * 60 * 1000);
|
||||
const { container } = render(<DateCell date={date} />);
|
||||
expect(container.querySelector("div")).not.toBeNull();
|
||||
expect(container.querySelector("div")?.getAttribute("title")).toBeTruthy();
|
||||
expect(container.textContent).toMatch(/ago|vor/i);
|
||||
});
|
||||
|
||||
it("renders date with specific displays", () => {
|
||||
const date = new Date(Date.now() - 60 * 60 * 1000);
|
||||
const { container } = render(<DateCell date={date} displays={["dm", "ago"]} />);
|
||||
expect(container.querySelector("div")).not.toBeNull();
|
||||
expect(container.querySelector("div")?.getAttribute("title")).toBeTruthy();
|
||||
expect(container.textContent).toMatch(/ago|vor/i);
|
||||
expect(container.textContent).not.toContain("ymd");
|
||||
});
|
||||
|
||||
it("renders empty when date is null", () => {
|
||||
const { container } = render(<DateCell date={null} />);
|
||||
expect(container.querySelector("div")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user