Skip to content

refactor: architectural decouple for testability and CI pipeline integration#7

Merged
Hectormalvarez merged 10 commits into
mainfrom
dev
Jun 5, 2026
Merged

refactor: architectural decouple for testability and CI pipeline integration#7
Hectormalvarez merged 10 commits into
mainfrom
dev

Conversation

@Hectormalvarez

Copy link
Copy Markdown
Owner

Overview

This PR transitions the codebase from a tightly coupled vanilla implementation to a modular, test-driven architecture. By separating core state machines, side effects, and DOM rendering, we have unlocked absolute type safety and established a fail-fast delivery pipeline.

Architectural Changes

  • main.ts Isolation: Reduced from 80 lines of DOM lookups to a clean 4-line bootstrapper, delegating all responsibility directly to self-initializing components.
  • Timer Core Extraction: Split the state machine and math logic out of src/components/timer.ts into a mathematically pure timer-core.ts module with 100% test coverage.
  • Clock Engine Separation: Refactored the clock component into a decoupled view layer and a pure calculation function (computeClockTick), completely independent of browser runtime environments.
  • Dependency Injection: Updated audio utilities (playBeep) to accept an optional injected context, eliminating Node.js test crashes caused by missing Web Audio APIs.

Automated Validation Suite

  • Replaced the unused Jest config with a unified Vitest test runner integrated directly into the Vite build configuration.
  • Established 99 unit tests validating state transitions, input clamping, preset structures, and time formatting configurations.
  • Integrated an automated GitHub Actions CI workflow that strictly enforces Prettier formatting, ESLint analysis, TypeScript type checking (tsc --noEmit), and production bundle builds on all operations targeting dev and main.

@vercel

vercel Bot commented Jun 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clock-website Ready Ready Preview, Comment Jun 5, 2026 1:20pm

@Hectormalvarez Hectormalvarez merged commit c2f7e12 into main Jun 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant