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
51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|||
|
|
import { soundEngine } from "@/lib/audioFx";
|
||
|
|
|
||
|
|
describe("SnapCAD Dynamic Features — Gamification & Web Audio Synthesizer", () => {
|
||
|
|
it("manages soundEngine enabled status and toggle correctly", () => {
|
||
|
|
const initialStatus = soundEngine.isEnabled();
|
||
|
|
expect(typeof initialStatus).toBe("boolean");
|
||
|
|
|
||
|
|
soundEngine.setEnabled(false);
|
||
|
|
expect(soundEngine.isEnabled()).toBe(false);
|
||
|
|
|
||
|
|
soundEngine.setEnabled(true);
|
||
|
|
expect(soundEngine.isEnabled()).toBe(true);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("calculates level and XP progression accurately", () => {
|
||
|
|
const calculateGamificationLevel = (xp: number) => {
|
||
|
|
const level = Math.floor(xp / 250) + 1;
|
||
|
|
const currentLevelXp = xp % 250;
|
||
|
|
const progressPercent = Math.min(100, Math.round((currentLevelXp / 250) * 100));
|
||
|
|
return { level, currentLevelXp, progressPercent };
|
||
|
|
};
|
||
|
|
|
||
|
|
expect(calculateGamificationLevel(0)).toEqual({ level: 1, currentLevelXp: 0, progressPercent: 0 });
|
||
|
|
expect(calculateGamificationLevel(125)).toEqual({ level: 1, currentLevelXp: 125, progressPercent: 50 });
|
||
|
|
expect(calculateGamificationLevel(250)).toEqual({ level: 2, currentLevelXp: 0, progressPercent: 0 });
|
||
|
|
expect(calculateGamificationLevel(550)).toEqual({ level: 3, currentLevelXp: 50, progressPercent: 20 });
|
||
|
|
});
|
||
|
|
|
||
|
|
it("validates visual style shader palette definitions", () => {
|
||
|
|
type VisualStyle = "shaded" | "blueprint" | "cyberpunk" | "clay";
|
||
|
|
|
||
|
|
const getStyleBackground = (style: VisualStyle, defaultBg: string) => {
|
||
|
|
switch (style) {
|
||
|
|
case "blueprint":
|
||
|
|
return "#0a2540";
|
||
|
|
case "cyberpunk":
|
||
|
|
return "#050914";
|
||
|
|
case "clay":
|
||
|
|
return "#e5e1d8";
|
||
|
|
default:
|
||
|
|
return defaultBg;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
expect(getStyleBackground("blueprint", "#ffffff")).toBe("#0a2540");
|
||
|
|
expect(getStyleBackground("cyberpunk", "#ffffff")).toBe("#050914");
|
||
|
|
expect(getStyleBackground("clay", "#ffffff")).toBe("#e5e1d8");
|
||
|
|
expect(getStyleBackground("shaded", "#f8fafc")).toBe("#f8fafc");
|
||
|
|
});
|
||
|
|
});
|