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
107 lines
2.6 KiB
TypeScript
107 lines
2.6 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||||
|
|
import type { WorkplaneShape } from "@/types/sketchforge";
|
|||
|
|
|
|||
|
|
describe("Architectural Layers & Tags System", () => {
|
|||
|
|
const sampleShapes: WorkplaneShape[] = [
|
|||
|
|
{
|
|||
|
|
id: "wall-1",
|
|||
|
|
name: "Dış Duvar",
|
|||
|
|
kind: "box",
|
|||
|
|
color: "#f8fafc",
|
|||
|
|
x: 0,
|
|||
|
|
z: 0,
|
|||
|
|
width: 50,
|
|||
|
|
depth: 40,
|
|||
|
|
height: 30,
|
|||
|
|
size: 50,
|
|||
|
|
rotation: 0,
|
|||
|
|
tag: "Duvarlar",
|
|||
|
|
hidden: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: "roof-1",
|
|||
|
|
name: "Kırma Çatı",
|
|||
|
|
kind: "pyramid",
|
|||
|
|
color: "#ef4444",
|
|||
|
|
x: 0,
|
|||
|
|
z: 0,
|
|||
|
|
elevation: 30,
|
|||
|
|
width: 54,
|
|||
|
|
depth: 44,
|
|||
|
|
height: 20,
|
|||
|
|
size: 54,
|
|||
|
|
rotation: 0,
|
|||
|
|
tag: "Çatı",
|
|||
|
|
hidden: false,
|
|||
|
|
},
|
|||
|
|
{
|
|||
|
|
id: "door-1",
|
|||
|
|
name: "Giriş Kapısı Boşluğu",
|
|||
|
|
kind: "box",
|
|||
|
|
hole: true,
|
|||
|
|
color: "#000000",
|
|||
|
|
x: 0,
|
|||
|
|
z: 20,
|
|||
|
|
width: 10,
|
|||
|
|
depth: 12,
|
|||
|
|
height: 20,
|
|||
|
|
size: 20,
|
|||
|
|
rotation: 0,
|
|||
|
|
tag: "Kapı & Boşluklar",
|
|||
|
|
hidden: false,
|
|||
|
|
},
|
|||
|
|
];
|
|||
|
|
|
|||
|
|
it("correctly groups shapes into distinct architectural tags", () => {
|
|||
|
|
const tagMap = new Map<string, WorkplaneShape[]>();
|
|||
|
|
sampleShapes.forEach((s) => {
|
|||
|
|
const tag = s.tag || "Katman 0 (Genel)";
|
|||
|
|
const list = tagMap.get(tag) || [];
|
|||
|
|
list.push(s);
|
|||
|
|
tagMap.set(tag, list);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
expect(tagMap.has("Duvarlar")).toBe(true);
|
|||
|
|
expect(tagMap.has("Çatı")).toBe(true);
|
|||
|
|
expect(tagMap.has("Kapı & Boşluklar")).toBe(true);
|
|||
|
|
expect(tagMap.get("Çatı")?.length).toBe(1);
|
|||
|
|
expect(tagMap.get("Çatı")?.[0].id).toBe("roof-1");
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
it("toggling tag visibility hides only shapes in the target tag", () => {
|
|||
|
|
const targetTag = "Çatı";
|
|||
|
|
const updated = sampleShapes.map((s) => {
|
|||
|
|
if (s.tag === targetTag) {
|
|||
|
|
return { ...s, hidden: true };
|
|||
|
|
}
|
|||
|
|
return s;
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
const roof = updated.find((s) => s.id === "roof-1");
|
|||
|
|
const wall = updated.find((s) => s.id === "wall-1");
|
|||
|
|
const door = updated.find((s) => s.id === "door-1");
|
|||
|
|
|
|||
|
|
expect(roof?.hidden).toBe(true);
|
|||
|
|
expect(wall?.hidden).toBe(false);
|
|||
|
|
expect(door?.hidden).toBe(false);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
it("defaults un-tagged shapes to 'Katman 0 (Genel)'", () => {
|
|||
|
|
const genericShape: WorkplaneShape = {
|
|||
|
|
id: "cube-new",
|
|||
|
|
name: "Kutu",
|
|||
|
|
kind: "box",
|
|||
|
|
color: "#cbd5e1",
|
|||
|
|
x: 20,
|
|||
|
|
z: 20,
|
|||
|
|
width: 20,
|
|||
|
|
depth: 20,
|
|||
|
|
height: 20,
|
|||
|
|
size: 20,
|
|||
|
|
rotation: 0,
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
const assignedTag = (genericShape.tag && genericShape.tag.trim()) || "Katman 0 (Genel)";
|
|||
|
|
expect(assignedTag).toBe("Katman 0 (Genel)");
|
|||
|
|
});
|
|||
|
|
});
|