mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-04 19:32:06 +00:00
29 lines
909 B
TypeScript
29 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)}…`);
|
||
|
|
});
|
||
|
|
});
|