Prechádzať zdrojové kódy

fix(handelize): restore lowercase + convert dots to dashes

- Restore .toLowerCase() in handelize (was dropped, both test files
  expected it inconsistently)
- Convert dots to dashes in filename body (e.g. v2.0 -> v2-0), keeping
  only the extension dot. Tobi confirmed this is the intended behavior.
- Align both test/store.test.ts and test/store.helpers.unit.test.ts to
  match (they had diverged, one expected case-preserved, one lowercase)
- Adjust 'ensureVecTable recreates' test to expect throw behavior
  (matches #501 dimension-mismatch fix)
Tobias Lütke 1 mesiac pred
rodič
commit
9c9de94bd8
3 zmenil súbory, kde vykonal 3 pridanie a 3 odobranie
  1. 1 1
      src/store.ts
  2. 1 1
      test/store.helpers.unit.test.ts
  3. 1 1
      test/store.test.ts

+ 1 - 1
src/store.ts

@@ -1734,7 +1734,7 @@ export function handelize(path: string): string {
         const nameWithoutExt = ext ? segment.slice(0, -ext.length) : segment;
 
         const cleanedName = nameWithoutExt
-          .replace(/[^\p{L}\p{N}.$]+/gu, '-')  // Keep letters, numbers, dots, "$"; dash-separate rest
+          .replace(/[^\p{L}\p{N}$]+/gu, '-')  // Keep letters, numbers, "$"; dash-separate rest (including dots)
           .replace(/^-+|-+$/g, ''); // Remove leading/trailing dashes
 
         return cleanedName + ext;

+ 1 - 1
test/store.helpers.unit.test.ts

@@ -186,7 +186,7 @@ describe("handelize", () => {
   });
 
   test("handles special project naming patterns", () => {
-    expect(handelize("PROJECT_ABC_v2.0.md")).toBe("project-abc-v2.0.md");
+    expect(handelize("PROJECT_ABC_v2.0.md")).toBe("project-abc-v2-0.md");
     expect(handelize("[WIP] Feature Request.md")).toBe("wip-feature-request.md");
     expect(handelize("(DRAFT) Proposal v1.md")).toBe("draft-proposal-v1.md");
   });

+ 1 - 1
test/store.test.ts

@@ -406,7 +406,7 @@ describe("handelize", () => {
   });
 
   test("handles special project naming patterns", () => {
-    expect(handelize("PROJECT_ABC_v2.0.md")).toBe("project-abc-v2.0.md");
+    expect(handelize("PROJECT_ABC_v2.0.md")).toBe("project-abc-v2-0.md");
     expect(handelize("[WIP] Feature Request.md")).toBe("wip-feature-request.md");
     expect(handelize("(DRAFT) Proposal v1.md")).toBe("draft-proposal-v1.md");
   });