mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 23:43:13 +00:00
28 lines
909 B
TypeScript
28 lines
909 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
hasServiceNotesDetails,
|
|
truncateServiceNotesPreview,
|
|
} from "@/domain/work-orders/utils/service-notes-ui";
|
|
|
|
describe("hasServiceNotesDetails", () => {
|
|
it("is false when empty", () => {
|
|
expect(hasServiceNotesDetails("", [])).toBe(false);
|
|
expect(hasServiceNotesDetails(null, null)).toBe(false);
|
|
});
|
|
|
|
it("is true when notes or extras exist", () => {
|
|
expect(hasServiceNotesDetails("service notes", [])).toBe(true);
|
|
expect(hasServiceNotesDetails("", ["Filter change"])).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("truncateServiceNotesPreview", () => {
|
|
it("keeps short notes", () => {
|
|
expect(truncateServiceNotesPreview("service notes")).toBe("service notes");
|
|
});
|
|
|
|
it("truncates long notes with ellipsis", () => {
|
|
const long = "a".repeat(40);
|
|
expect(truncateServiceNotesPreview(long)).toBe(`${"a".repeat(30)}…`);
|
|
});
|
|
});
|