Files
snapcad-studio/tests/unit/exportNames.test.ts
T

18 lines
887 B
TypeScript
Raw Normal View History

2026-06-20 10:07:33 +03:00
import { describe, expect, it } from "vitest";
import { projectExportFileName } from "@/lib/exportNames";
describe("project export filenames", () => {
it("uses the project name for each supported export format", () => {
expect(projectExportFileName("Gearbox Prototype", "stl")).toBe("Gearbox Prototype.stl");
expect(projectExportFileName("Gearbox Prototype", "obj")).toBe("Gearbox Prototype.obj");
expect(projectExportFileName("Gearbox Prototype", "step")).toBe("Gearbox Prototype.step");
2026-06-20 10:07:33 +03:00
});
it("removes filesystem-reserved characters without discarding the project name", () => {
expect(projectExportFileName(' enclosure: v2 / final? ', "stl")).toBe("enclosure- v2 - final-.stl");
});
it("falls back to a useful name when the project name cannot be used", () => {
expect(projectExportFileName("...", "obj")).toBe("SketchForge design.obj");
});
});