TypeScript
test: add Vitest unit tests for dates, leave rules and event layout
Vipul Kumar70ea4e630422
diff --git a/package-lock.json b/package-lock.jsonindex 2a4b311..e0b4d49 100644--- a/package-lock.json+++ b/package-lock.json@@ -24,13 +24,14 @@},"devDependencies": {"@tailwindcss/turbopack": "^4",- "@types/node": "^20",+ "@types/node": "^26.6.5","@types/react": "^19","@types/react-dom": "^19","eslint": "^9","eslint-config-next": "16.4.3","tailwindcss": "^4",- "typescript": "^5"+ "typescript": "^5",+ "vitest": "^5.0.5"}},"node_modules/@alloc/quick-lru": {@@ -1890,6 +1891,17 @@"node": ">=12.4.0"}},+ "node_modules/@oxc-project/types": {+ "version": "0.155.0",+ "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.155.0.tgz",+ "integrity": "sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "funding": {+ "url": "https://github.com/sponsors/oxc-project"+ }+ },"node_modules/@radix-ui/number": {"version": "1.1.3","resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.3.tgz",@@ -3393,6 +3405,302 @@"integrity": "sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw==","license": "MIT"},+ "node_modules/@rolldown/binding-android-arm-eabi": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.15.tgz",+ "integrity": "sha512-aLcgK9gIJ3YRvrrtfSBbRa27F5WrpiTaPulnFpsHPxpUHgFlSgnU4854MHwoRGEBhfRJDWCS2WQ7lIjskE9Olw==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-android-arm64": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.15.tgz",+ "integrity": "sha512-xD7DdZCrbThKuxNg7ooQmvp07ys4J/pnSEMTG3/OdOWl6daC67m/Q4fL78sRHMxTH/N4fGUbYhcPM0MF5WFHkg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "android"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-darwin-arm64": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.15.tgz",+ "integrity": "sha512-m2WuQ6r0B4OTYxyPpNLtXaMRbRDUbG8YQV2Q3KTdSSK8Th6KHCnC8jVCJt8bvYeSB5WivkkNbc85mKadaSdOxA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-darwin-x64": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.15.tgz",+ "integrity": "sha512-5RtnsHM36nodM9WbMy+zip0LGS/G+y5wro5RHrpOlr4ac24+1zSi9kiV2MP1myZeZ/ifEHfulQcWjnAXzc2C2A==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-freebsd-x64": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.15.tgz",+ "integrity": "sha512-g3l09pyFqhu+135JKkbkwiKGQmwU5hUMUPJ4VdBADvuqR8d33L6H578rh8m7rtxbdp+VmX/+nzI7nvhSZlzpUQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm-gnueabihf": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.15.tgz",+ "integrity": "sha512-nIe3VugI97nGQtspPxDqA4sXMUpeiocKIP/CqpY/u/vgbT+alX+cVxu1C/oVBPKg4feNTmYovE91v4DgXvXNwQ==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm64-gnu": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.15.tgz",+ "integrity": "sha512-iTBjXx+B5QSvgI89lJfmqh4wTh8NabR1YZIIN3hNx4zSG0EVfVqkOvLulNpG4251pbd6/IAmZ/LefVk1Y4rPhw==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-arm64-musl": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.15.tgz",+ "integrity": "sha512-uN26XOnVR7rqQupG3V9oAG2EGGatWjcJHOeDOHUFCh4TBWmP2tHTFoVN13aYbwfm0aHqJAEmcwhAu6sooIjfqQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "libc": [+ "musl"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-ppc64-gnu": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.15.tgz",+ "integrity": "sha512-9nWkcdd+H+XhaA3fQIwpHnKIrfx/PQ6rO0pivr78Og07tXlUlctBBJoEYLPfhTmCR/QxEVdn6uPjHV5SymPhdw==",+ "cpu": [+ "ppc64"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-s390x-gnu": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.15.tgz",+ "integrity": "sha512-Ggh0ciFjLwIusLSLz7LZYEaGdxOAUJXI+Qu5JCbhPJJHEt8vP+IjRATTJheiJsdzzTYgUiHUiw3X1Ea3ZpMBdA==",+ "cpu": [+ "s390x"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-x64-gnu": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.15.tgz",+ "integrity": "sha512-FHg60rS6DBePAYZ9X9F67x+JObFdmgn6tupA1C/a3B+CufFmTD4mX+e8M75tCiAO3foR/6xwVBI0KQiI7sn/rw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-linux-x64-musl": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.15.tgz",+ "integrity": "sha512-/cvV/7v5VGz/moiz0XKRj2dE8DzsKyhIu1KpOvJGPjRywg3yscON889UGvAe8zfiJLHup7VLjBduoGWi3HusWQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "libc": [+ "musl"+ ],+ "license": "MIT",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-openharmony-arm64": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.15.tgz",+ "integrity": "sha512-MyzC5Hrv/sm+Z7TSGKP/j8001RO2xQm1zOpCNVL4j0cY/VhBZviludA2YFQ7i4lH6ZAXxQm0lcMdBzM+99mE7w==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "openharmony"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-win32-arm64-msvc": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.15.tgz",+ "integrity": "sha512-+PgYiS+AH5omy6L45ZLxybasauJaj3M8buoT83D+nzPmCayXlxUV9hydhciCKVyIg0B/v0BtXPDE1uGqNwCPpg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/binding-win32-x64-msvc": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.15.tgz",+ "integrity": "sha512-HFZd2QNQYn1JbIi+Hpd7H+r/lkWxcfIu28nirZ6eCn2LafuvmExMlb/P96Sfx5tf7pPArw39IdhmCF8vmV+NhQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ }+ },+ "node_modules/@rolldown/pluginutils": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",+ "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",+ "dev": true,+ "license": "MIT",+ "peer": true+ },"node_modules/@rtsao/scc": {"version": "1.1.0","resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz",@@ -3883,6 +4191,24 @@"tslib": "^2.4.0"}},+ "node_modules/@types/chai": {+ "version": "5.2.3",+ "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz",+ "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/deep-eql": "*",+ "assertion-error": "^2.0.1"+ }+ },+ "node_modules/@types/deep-eql": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz",+ "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==",+ "dev": true,+ "license": "MIT"+ },"node_modules/@types/estree": {"version": "1.0.9","resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",@@ -3905,13 +4231,13 @@"license": "MIT"},"node_modules/@types/node": {- "version": "20.19.43",- "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",- "integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",+ "version": "26.6.5",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.5.tgz",+ "integrity": "sha512-uMzsv9stDdofIZBx4UGh4Z9ZgXnGC9seRDscilBcTHAeOFk67MZg/k9bWVfO+bk4qZmG+l52hRnLwUiH2LnJTg==","dev": true,"license": "MIT","dependencies": {- "undici-types": "~6.21.0"+ "undici-types": "~8.9.0"}},"node_modules/@types/react": {@@ -4589,6 +4915,54 @@"win32"]},+ "node_modules/@vitest/mocker": {+ "version": "5.0.5",+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.5.tgz",+ "integrity": "sha512-xLL3lkDegJZw+MGoGaCCsFayDZthGgpAtr3Vziyfc4p7xH89K7KRPcRBBh/kEYm0Aqkt5DtTmkYpBtRV/FrHZg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/trace-mapping": "0.3.31",+ "@vitest/spy": "5.0.5",+ "estree-walker": "^3.0.3",+ "magic-string": "^1.4.3"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "msw": "^2.4.9 || ^3.0.0",+ "vite": "^6.0.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "msw": {+ "optional": true+ },+ "vite": {+ "optional": true+ }+ }+ },+ "node_modules/@vitest/mocker/node_modules/magic-string": {+ "version": "1.4.4",+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.4.tgz",+ "integrity": "sha512-jQz9sVhrZuphH4NrAIHSgkDJCluQO7Ioi4KGRLa7aTUjAODQ13hENX0YIytqYE/rIkO485gQG2LeBxJaW53kkQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.6.0"+ }+ },+ "node_modules/@vitest/spy": {+ "version": "5.0.5",+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.5.tgz",+ "integrity": "sha512-lwJRExuH417257Q5wv9QYugN9IMJkoxcrKrYxGPQkBzl7wlNpTUxD/5yNX4ESKVUIShKPgkGchYPFMWOOk0wzw==",+ "dev": true,+ "license": "MIT",+ "funding": {+ "url": "https://opencollective.com/vitest"+ }+ },"node_modules/accepts": {"version": "2.0.0","resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",@@ -4904,6 +5278,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/assertion-error": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/ast-types": {"version": "0.16.3","resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.16.3.tgz",@@ -5192,6 +5576,16 @@],"license": "CC-BY-4.0"},+ "node_modules/chai": {+ "version": "6.3.0",+ "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz",+ "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/chalk": {"version": "4.1.2","resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",@@ -5995,8 +6389,15 @@"node": ">= 0.4"}},- "node_modules/es-object-atoms": {- "version": "1.1.2",+ "node_modules/es-module-lexer": {+ "version": "2.3.2",+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz",+ "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==",+ "dev": true,+ "license": "MIT"+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.2","resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz","integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==","license": "MIT",@@ -6495,6 +6896,16 @@"node": ">=4.0"}},+ "node_modules/estree-walker": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/estree": "^1.0.0"+ }+ },"node_modules/esutils": {"version": "2.0.3","resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",@@ -6561,6 +6972,16 @@"url": "https://github.com/sindresorhus/execa?sponsor=1"}},+ "node_modules/expect-type": {+ "version": "1.4.0",+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",+ "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",+ "dev": true,+ "license": "Apache-2.0",+ "engines": {+ "node": ">=12.0.0"+ }+ },"node_modules/express": {"version": "5.3.0","resolved": "https://registry.npmjs.org/express/-/express-5.3.0.tgz",@@ -6858,6 +7279,22 @@"node": ">=14.14"}},+ "node_modules/fsevents": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",+ "dev": true,+ "hasInstallScript": true,+ "license": "MIT",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"+ }+ },"node_modules/function-bind": {"version": "1.1.2","resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",@@ -8934,6 +9371,20 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/obug": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz",+ "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==",+ "dev": true,+ "funding": [+ "https://github.com/sponsors/sxzz",+ "https://opencollective.com/debug"+ ],+ "license": "MIT",+ "engines": {+ "node": ">=12.20.0"+ }+ },"node_modules/on-finished": {"version": "2.4.2","resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz",@@ -9860,6 +10311,41 @@"node": ">=0.10.0"}},+ "node_modules/rolldown": {+ "version": "1.2.15",+ "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.15.tgz",+ "integrity": "sha512-6odND+fel5zVw3I4Yc2e69gvguDnX0CAAGiNDZSq4ik5WUcaLrkD2GLuog0XcODbor31hZ5ayEMgVDno+KPV5g==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "@oxc-project/types": "=0.155.0",+ "@rolldown/pluginutils": "^1.0.0"+ },+ "bin": {+ "rolldown": "bin/cli.mjs"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "optionalDependencies": {+ "@rolldown/binding-android-arm-eabi": "1.2.15",+ "@rolldown/binding-android-arm64": "1.2.15",+ "@rolldown/binding-darwin-arm64": "1.2.15",+ "@rolldown/binding-darwin-x64": "1.2.15",+ "@rolldown/binding-freebsd-x64": "1.2.15",+ "@rolldown/binding-linux-arm-gnueabihf": "1.2.15",+ "@rolldown/binding-linux-arm64-gnu": "1.2.15",+ "@rolldown/binding-linux-arm64-musl": "1.2.15",+ "@rolldown/binding-linux-ppc64-gnu": "1.2.15",+ "@rolldown/binding-linux-s390x-gnu": "1.2.15",+ "@rolldown/binding-linux-x64-gnu": "1.2.15",+ "@rolldown/binding-linux-x64-musl": "1.2.15",+ "@rolldown/binding-openharmony-arm64": "1.2.15",+ "@rolldown/binding-win32-arm64-msvc": "1.2.15",+ "@rolldown/binding-win32-x64-msvc": "1.2.15"+ }+ },"node_modules/router": {"version": "2.2.0","resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",@@ -10435,6 +10921,13 @@"node": ">= 0.8"}},+ "node_modules/std-env": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz",+ "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==",+ "dev": true,+ "license": "MIT"+ },"node_modules/stdin-discarder": {"version": "0.2.2","resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz",@@ -10802,6 +11295,26 @@"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==","license": "MIT"},+ "node_modules/tinybench": {+ "version": "6.2.2",+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.2.tgz",+ "integrity": "sha512-nIZ2N2dFpjBsg2hgitKu7mA+FvsIJuGJOwysRngmVRRmWgR/UyPjwJj8c/fT/dhm8EkHnF5EOogRf+0Z2qrimA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=20.0.0"+ }+ },+ "node_modules/tinyexec": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz",+ "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=18"+ }+ },"node_modules/tinyglobby": {"version": "0.2.17","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",@@ -11135,9 +11648,9 @@}},"node_modules/undici-types": {- "version": "6.21.0",- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",- "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",+ "version": "8.9.0",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",+ "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==","dev": true,"license": "MIT"},@@ -11316,6 +11829,498 @@"node": ">= 0.8"}},+ "node_modules/vite": {+ "version": "8.3.5",+ "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.5.tgz",+ "integrity": "sha512-z1YpjieJ9g0ebTmQpLBv/oq9E3F9EIlOe+7LahW8SrE3LTiG3udBRUXQOlYXP9b+IC2q2phHeVxj9xGlw34OEQ==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "lightningcss": "^1.33.0",+ "picomatch": "^4.0.7",+ "postcss": "^8.5.30",+ "rolldown": "~1.2.14",+ "tinyglobby": "^0.2.17"+ },+ "bin": {+ "vite": "bin/vite.js"+ },+ "engines": {+ "node": "^20.19.0 || >=22.12.0"+ },+ "funding": {+ "url": "https://github.com/vitejs/vite?sponsor=1"+ },+ "optionalDependencies": {+ "fsevents": "~2.3.3"+ },+ "peerDependencies": {+ "@types/node": "^20.19.0 || >=22.12.0",+ "@vitejs/devtools": "^0.7.1 || ^0.8.0",+ "esbuild": "^0.27.0 || ^0.28.0",+ "jiti": ">=1.21.0",+ "less": "^4.0.0",+ "sass": "^1.70.0",+ "sass-embedded": "^1.70.0",+ "stylus": ">=0.54.8",+ "sugarss": "^5.0.0",+ "terser": "^5.16.0",+ "tsx": "^4.8.1",+ "yaml": "^2.4.2"+ },+ "peerDependenciesMeta": {+ "@types/node": {+ "optional": true+ },+ "@vitejs/devtools": {+ "optional": true+ },+ "esbuild": {+ "optional": true+ },+ "jiti": {+ "optional": true+ },+ "less": {+ "optional": true+ },+ "sass": {+ "optional": true+ },+ "sass-embedded": {+ "optional": true+ },+ "stylus": {+ "optional": true+ },+ "sugarss": {+ "optional": true+ },+ "terser": {+ "optional": true+ },+ "tsx": {+ "optional": true+ },+ "yaml": {+ "optional": true+ }+ }+ },+ "node_modules/vite/node_modules/lightningcss": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",+ "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",+ "dev": true,+ "license": "MPL-2.0",+ "peer": true,+ "dependencies": {+ "detect-libc": "^2.0.3"+ },+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ },+ "optionalDependencies": {+ "lightningcss-android-arm64": "1.33.0",+ "lightningcss-darwin-arm64": "1.33.0",+ "lightningcss-darwin-x64": "1.33.0",+ "lightningcss-freebsd-x64": "1.33.0",+ "lightningcss-linux-arm-gnueabihf": "1.33.0",+ "lightningcss-linux-arm64-gnu": "1.33.0",+ "lightningcss-linux-arm64-musl": "1.33.0",+ "lightningcss-linux-x64-gnu": "1.33.0",+ "lightningcss-linux-x64-musl": "1.33.0",+ "lightningcss-win32-arm64-msvc": "1.33.0",+ "lightningcss-win32-x64-msvc": "1.33.0"+ }+ },+ "node_modules/vite/node_modules/lightningcss-darwin-arm64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",+ "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-darwin-x64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",+ "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-freebsd-x64": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",+ "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "freebsd"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-linux-arm-gnueabihf": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",+ "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",+ "cpu": [+ "arm"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-linux-arm64-gnu": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",+ "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-linux-arm64-musl": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",+ "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "libc": [+ "musl"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-linux-x64-gnu": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",+ "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "libc": [+ "glibc"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-linux-x64-musl": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",+ "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "libc": [+ "musl"+ ],+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-win32-arm64-msvc": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",+ "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",+ "cpu": [+ "arm64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/lightningcss-win32-x64-msvc": {+ "version": "1.33.0",+ "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",+ "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",+ "cpu": [+ "x64"+ ],+ "dev": true,+ "license": "MPL-2.0",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": ">= 12.0.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/parcel"+ }+ },+ "node_modules/vite/node_modules/picomatch": {+ "version": "4.0.7",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",+ "dev": true,+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },+ "node_modules/vite/node_modules/postcss": {+ "version": "8.5.31",+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.31.tgz",+ "integrity": "sha512-YUbWYCgErwnMAVkjUnYa+KlMBzGpHwiIt/DE7f0G33AuX2LH9UcTk6KgWxd3zRU+pN3u/C+Xl3EnMLM4Hea7Sg==",+ "dev": true,+ "funding": [+ {+ "type": "opencollective",+ "url": "https://opencollective.com/postcss/"+ },+ {+ "type": "tidelift",+ "url": "https://tidelift.com/funding/github/npm/postcss"+ },+ {+ "type": "github",+ "url": "https://github.com/sponsors/ai"+ }+ ],+ "license": "MIT",+ "peer": true,+ "dependencies": {+ "nanoid": "^3.3.20",+ "picocolors": "^1.1.1",+ "source-map-js": "^1.2.2"+ },+ "engines": {+ "node": "^10 || ^12 || >=14"+ }+ },+ "node_modules/vitest": {+ "version": "5.0.5",+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.5.tgz",+ "integrity": "sha512-cPODOMF8YnkiiYtDdHo6n4wWmBrOBBbOIYH2d33M4l3CdNn72h+qMmO6uXffUN6A5AZFXNND/d+krS9mgkXRfg==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/chai": "^5.2.2",+ "@vitest/mocker": "5.0.5",+ "chai": "^6.3.0",+ "es-module-lexer": "^2.3.2",+ "expect-type": "^1.4.0",+ "magic-string": "^1.4.3",+ "obug": "^3.0.0",+ "picomatch": "^4.0.7",+ "std-env": "^4.3.0",+ "tinybench": "^6.2.2",+ "tinyexec": "^1.3.1",+ "tinyglobby": "^0.2.17",+ "why-is-node-running": "3.2.1"+ },+ "bin": {+ "vitest": "vitest.mjs"+ },+ "engines": {+ "node": "^22.12.0 || ^24.0.0 || >=26.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/vitest"+ },+ "peerDependencies": {+ "@edge-runtime/vm": "*",+ "@opentelemetry/api": "^1.9.0",+ "@types/node": "^22.0.0 || >=24.0.0",+ "@vitest/browser-playwright": "5.0.5",+ "@vitest/browser-preview": "5.0.5",+ "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",+ "@vitest/coverage-istanbul": "5.0.5",+ "@vitest/coverage-v8": "5.0.5",+ "@vitest/ui": "5.0.5",+ "happy-dom": "*",+ "jsdom": "*",+ "vite": "^6.4.0 || ^7.0.0 || ^8.0.0"+ },+ "peerDependenciesMeta": {+ "@edge-runtime/vm": {+ "optional": true+ },+ "@opentelemetry/api": {+ "optional": true+ },+ "@types/node": {+ "optional": true+ },+ "@vitest/browser-playwright": {+ "optional": true+ },+ "@vitest/browser-preview": {+ "optional": true+ },+ "@vitest/browser-webdriverio": {+ "optional": true+ },+ "@vitest/coverage-istanbul": {+ "optional": true+ },+ "@vitest/coverage-v8": {+ "optional": true+ },+ "@vitest/ui": {+ "optional": true+ },+ "happy-dom": {+ "optional": true+ },+ "jsdom": {+ "optional": true+ },+ "vite": {+ "optional": false+ }+ }+ },+ "node_modules/vitest/node_modules/magic-string": {+ "version": "1.4.4",+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.4.tgz",+ "integrity": "sha512-jQz9sVhrZuphH4NrAIHSgkDJCluQO7Ioi4KGRLa7aTUjAODQ13hENX0YIytqYE/rIkO485gQG2LeBxJaW53kkQ==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@jridgewell/sourcemap-codec": "^1.6.0"+ }+ },+ "node_modules/vitest/node_modules/picomatch": {+ "version": "4.0.7",+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",+ "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",+ "dev": true,+ "license": "MIT",+ "engines": {+ "node": ">=12"+ },+ "funding": {+ "url": "https://github.com/sponsors/jonschlinkert"+ }+ },"node_modules/which": {"version": "2.0.2","resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",@@ -11420,6 +12425,19 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/why-is-node-running": {+ "version": "3.2.1",+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz",+ "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==",+ "dev": true,+ "license": "MIT",+ "bin": {+ "why-is-node-running": "cli.js"+ },+ "engines": {+ "node": ">=20.11"+ }+ },"node_modules/word-wrap": {"version": "1.2.5","resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",diff --git a/package.json b/package.jsonindex 684fac5..7cf7798 100644--- a/package.json+++ b/package.json@@ -6,7 +6,9 @@"dev": "next dev","build": "next build","start": "next start",- "lint": "eslint"+ "lint": "eslint",+ "test": "vitest run",+ "typecheck": "tsc --noEmit"},"dependencies": {"class-variance-authority": "^0.7.1",@@ -25,12 +27,13 @@},"devDependencies": {"@tailwindcss/turbopack": "^4",- "@types/node": "^20",+ "@types/node": "^26.6.5","@types/react": "^19","@types/react-dom": "^19","eslint": "^9","eslint-config-next": "16.4.3","tailwindcss": "^4",- "typescript": "^5"+ "typescript": "^5",+ "vitest": "^5.0.5"}}diff --git a/src/components/calendar/layout.test.ts b/src/components/calendar/layout.test.tsnew file mode 100644index 0000000..dc74a25--- /dev/null+++ b/src/components/calendar/layout.test.ts@@ -0,0 +1,34 @@+import { describe, expect, it } from "vitest";+import type { CalEvent } from "@/lib/types";+import { layoutDay, snap } from "./layout";++const ev = (id: string, start: number, end: number): CalEvent => ({+ id,+ title: id,+ date: "2026-11-10",+ start,+ end,+ allDay: false,+ color: "blue",+});++describe("layoutDay", () => {+ it("gives non-overlapping events the full width", () => {+ const out = layoutDay([ev("a", 420, 540), ev("b", 660, 780)]);+ expect(out.map((p) => p.columns)).toEqual([1, 1]);+ });++ it("splits overlapping events into columns", () => {+ const out = layoutDay([ev("a", 540, 660), ev("b", 600, 720), ev("c", 690, 750)]);+ const byId = Object.fromEntries(out.map((p) => [p.event.id, p]));+ expect(byId.a.column).toBe(0);+ expect(byId.b.column).toBe(1);+ expect(byId.c.column).toBe(0);+ expect(out.every((p) => p.columns === 2)).toBe(true);+ });++ it("snaps to 15-minute steps", () => {+ expect(snap(607)).toBe(600);+ expect(snap(608)).toBe(615);+ });+});diff --git a/src/lib/dates.test.ts b/src/lib/dates.test.tsnew file mode 100644index 0000000..4613600--- /dev/null+++ b/src/lib/dates.test.ts@@ -0,0 +1,59 @@+import { describe, expect, it } from "vitest";+import {+ addDays,+ addMonths,+ diffDays,+ formatRange,+ formatTime,+ isoWeek,+ monthGrid,+ parseTime,+ startOfWeek,+ weekDays,+} from "./dates";++describe("dates", () => {+ it("builds the design's Sunday-first week around Tue Nov 10, 2026", () => {+ expect(weekDays("2026-11-10", 0)).toEqual([+ "2026-11-08",+ "2026-11-09",+ "2026-11-10",+ "2026-11-11",+ "2026-11-12",+ "2026-11-13",+ "2026-11-14",+ ]);+ expect(startOfWeek("2026-11-10", 1)).toBe("2026-11-09");+ });++ it("reports ISO week 46 for that week", () => {+ expect(isoWeek("2026-11-09")).toBe(46);+ expect(isoWeek("2026-01-01")).toBe(1);+ expect(isoWeek("2027-01-01")).toBe(53);+ });++ it("formats ranges within and across months", () => {+ expect(formatRange("2026-11-08", "2026-11-14")).toBe("Nov 8 – 14");+ expect(formatRange("2026-10-25", "2026-10-31")).toBe("Oct 25 – 31");+ expect(formatRange("2026-11-29", "2026-12-05")).toBe("Nov 29 – Dec 5");+ });++ it("adds days and months without drifting", () => {+ expect(addDays("2026-12-31", 1)).toBe("2027-01-01");+ expect(addMonths("2026-01-31", 1)).toBe("2026-02-28");+ expect(diffDays("2026-11-08", "2026-11-14")).toBe(6);+ });++ it("returns a 6×7 month grid starting on the week start", () => {+ const grid = monthGrid("2026-11-10", 0);+ expect(grid).toHaveLength(42);+ expect(grid[0]).toBe("2026-11-01");+ });++ it("formats and parses times in 24h and 12h", () => {+ expect(formatTime(7 * 60)).toBe("07:00");+ expect(formatTime(13 * 60 + 30, "12h")).toBe("1:30 PM");+ expect(formatTime(0, "12h")).toBe("12:00 AM");+ expect(parseTime("09:45")).toBe(585);+ });+});diff --git a/src/lib/leave.test.ts b/src/lib/leave.test.tsnew file mode 100644index 0000000..41730ae--- /dev/null+++ b/src/lib/leave.test.ts@@ -0,0 +1,30 @@+import { describe, expect, it } from "vitest";+import { computeLeaveStats, durationLabel, formatDays, workingDays } from "./leave";+import { createSeed } from "./seed";++describe("leave rules", () => {+ it("reproduces the stats shown in the design from the seed", () => {+ const seed = createSeed();+ const stats = computeLeaveStats(seed, "2026-10-26");+ expect(stats.available).toBe(7);+ expect(stats.pendingCount).toBe(2);+ expect(stats.upcoming).toBe(3);+ expect(stats.contract).toBe(12);+ expect(stats.carryover).toBe(4);+ expect(stats.holidays).toBe(12);+ });++ it("skips weekends and public holidays when counting days", () => {+ const holidays = [{ id: "h", date: "2026-11-11", name: "Test" }];+ // Mon 9 → Sun 15: five weekdays minus one holiday+ expect(workingDays("2026-11-09", "2026-11-15", holidays)).toHaveLength(4);+ });++ it("labels durations naturally", () => {+ expect(durationLabel(1, 0)).toBe("1 day");+ expect(durationLabel(2, 4)).toBe("2 days 4 hours");+ expect(durationLabel(0, 1)).toBe("1 hour");+ expect(formatDays(0.75)).toBe("0.75");+ expect(formatDays(7)).toBe("7");+ });+});diff --git a/vitest.config.mts b/vitest.config.mtsnew file mode 100644index 0000000..3505082--- /dev/null+++ b/vitest.config.mts@@ -0,0 +1,7 @@+import { fileURLToPath } from "node:url";+import { defineConfig } from "vitest/config";++export default defineConfig({+ resolve: { alias: { "@": fileURLToPath(new URL("./src", import.meta.url)) } },+ test: { include: ["src/**/*.test.ts"] },+});