Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
feat: add metric screw hole cutters
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createScrewHoleShape, screwHoleDimensions, type ScrewHoleConfig } from "@/lib/screwHoles";
|
||||
|
||||
const m3Socket: ScrewHoleConfig = { metric: "M3", screwLength: 8, head: "socket", fit: "standard", mount: "clearance", depthMode: "through", depth: 20.4 };
|
||||
|
||||
describe("screw hole generator", () => {
|
||||
it("uses the expected M3 clearance and socket recess dimensions", () => {
|
||||
expect(screwHoleDimensions(m3Socket)).toMatchObject({ shaftDiameter: 3.4, headDiameter: 5.7, recessDepth: 3.1, totalDepth: 20.4, countersunk: false });
|
||||
});
|
||||
|
||||
it("creates an editable native Hole cutter made from watertight primitives", () => {
|
||||
const hole = createScrewHoleShape(m3Socket, { x: 12, z: -8, elevation: -0.4 }, "test-screw-hole");
|
||||
expect(hole).toMatchObject({ id: "test-screw-hole", kind: "mesh", hole: true, x: 12, z: -8, elevation: -0.4, height: 20.4, screwHole: m3Socket });
|
||||
expect(hole.importedMesh).toBeUndefined();
|
||||
expect(hole.groupedShapes).toHaveLength(2);
|
||||
expect(hole.groupedShapes?.[0]).toMatchObject({ kind: "cylinder", hole: true, elevation: 0, width: 3.4 });
|
||||
expect(hole.groupedShapes?.[0]?.height).toBeCloseTo(17.3);
|
||||
expect(hole.groupedShapes?.[1]).toMatchObject({ kind: "cylinder", hole: true, width: 5.7, height: 3.1 });
|
||||
expect(hole.groupedShapes?.[1]?.elevation).toBeCloseTo(17.3);
|
||||
});
|
||||
|
||||
it("supports a six-sided nut-trap cutter and a countersunk clearance cutter", () => {
|
||||
const nutTrap = screwHoleDimensions({ ...m3Socket, mount: "nutTrap" });
|
||||
const countersunk = screwHoleDimensions({ ...m3Socket, head: "countersunk" });
|
||||
expect(nutTrap.sides).toBe(6);
|
||||
expect(nutTrap.headDiameter).toBeGreaterThan(nutTrap.shaftDiameter);
|
||||
expect(countersunk.countersunk).toBe(true);
|
||||
const countersunkCutter = createScrewHoleShape({ ...m3Socket, head: "countersunk" }, { x: 0, z: 0, elevation: 0 }, "countersink");
|
||||
expect(countersunkCutter.groupedShapes).toEqual(expect.arrayContaining([expect.objectContaining({ kind: "cone", hole: true, baseRadius: countersunk.shaftDiameter / 2, topRadius: countersunk.headDiameter / 2 })]));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user