Open source alternative to Semrush and Ahrefs
TypeScript backlink-analysisgoogle-search-console-mcpkeyword-researchmcpseoseo-agentseo-auditseo-automationseo-skillsseo-toolssite-audit
test: add vitest checks and run tests in CI (#21)
Ben Senescu7b4f85dc10aa
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 16a6e1e3..47fcf1c2 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -37,6 +37,9 @@ jobs:- name: Run CI checksrun: pnpm run ci:check+ - name: Run tests+ run: pnpm run test:ci+- name: Install website dependenciesrun: pnpm --dir web install --frozen-lockfilediff --git a/package.json b/package.jsonindex de3a30c9..048bc194 100644--- a/package.json+++ b/package.json@@ -20,6 +20,9 @@"db:migrate:local": "wrangler d1 migrations apply DB --local","db:migrate:prod": "wrangler d1 migrations apply DB --remote","knip": "knip",+ "test": "vitest run",+ "test:watch": "vitest",+ "test:ci": "vitest run --reporter=dot","ci:check": "prettier --check . && knip && tsc --noEmit && oxlint . --type-aware"},"cloudflare": {@@ -86,6 +89,7 @@"typescript": "^5.9.3","vite": "^7.1.2","vite-tsconfig-paths": "^5.1.4",+ "vitest": "^3.2.4","wrangler": "^4.45.3"}}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a511c502..a2dd7fdb 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -144,6 +144,9 @@ importers:vite-tsconfig-paths:specifier: ^5.1.4version: 5.1.4([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ vitest:+ specifier: ^3.2.4wrangler:specifier: ^4.45.3version: 4.67.0(@cloudflare/[email protected])@@ -1815,6 +1818,9 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==}+ '@types/[email protected]':+ resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==}+'@types/[email protected]':resolution: {integrity: sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==}@@ -1842,6 +1848,9 @@ packages:'@types/[email protected]':resolution: {integrity: sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==}+ '@types/[email protected]':+ resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==}+'@types/[email protected]':resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==}@@ -1877,6 +1886,35 @@ packages:peerDependencies:vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0+ '@vitest/[email protected]':+ resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==}+ peerDependencies:+ msw: ^2.4.9+ vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0+ peerDependenciesMeta:+ msw:+ optional: true+ vite:+ optional: true++ '@vitest/[email protected]':+ resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==}++ '@vitest/[email protected]':+ resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==}+resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}engines: {node: '>=6.5'}@@ -1901,6 +1939,10 @@ packages:resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}+ resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}+ engines: {node: '>=12'}+resolution: {integrity: sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg==}engines: {node: '>=4'}@@ -1938,6 +1980,10 @@ packages:resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==}+ resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==}+ engines: {node: '>=8'}+resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}engines: {node: '>= 0.4'}@@ -1945,10 +1991,18 @@ packages:resolution: {integrity: sha512-DDdwPGz99nmIEv216hKSgLD+D4ikHQHjBC/seF98N9CPqRX4M5mSxT9eTV6oyisnJcuzxtZy4n17yKKQYmYQOA==}+ resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==}+ engines: {node: '>=18'}+resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==}engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}+ resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==}+ engines: {node: '>= 16'}+resolution: {integrity: sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==}@@ -2057,6 +2111,10 @@ packages:resolution: {integrity: sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==}+ resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==}+ engines: {node: '>=6'}+resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}engines: {node: '>=0.4.0'}@@ -2219,6 +2277,9 @@ packages:resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==}+resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==}engines: {node: '>= 0.4'}@@ -2259,6 +2320,9 @@ packages:engines: {node: '>=4'}hasBin: true+ resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==}+resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}engines: {node: '>=6'}@@ -2266,6 +2330,10 @@ packages:resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==}+ resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==}+ engines: {node: '>=12.0.0'}+resolution: {integrity: sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==}@@ -2440,6 +2508,9 @@ packages:resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}+ resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==}+resolution: {integrity: sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==}hasBin: true@@ -2551,6 +2622,9 @@ packages:resolution: {integrity: sha512-l51N2r93WmGUye3WuFoN5k10zyvrVs0qfKBhyC5ogUQ6Ew6JUSswh78mbSO+IU3nTWsyOArqPCcShdQSadghBQ==}engines: {node: '>= 12.0.0'}+ resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==}+resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}@@ -2661,6 +2735,10 @@ packages:resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==}+ resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==}+ engines: {node: '>= 14.16'}+resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==}@@ -2816,6 +2894,9 @@ packages:resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==}engines: {node: '>= 0.4'}+ resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}+resolution: {integrity: sha512-4zemZi0HvTnYwLfrpk/CF9LOd9Lt87kAt50GnqhMpyF9U3poDAP2+iukq2bZsO/ufegbYehBkqINbsWxj4l4cw==}engines: {node: '>= 18'}@@ -2854,10 +2935,19 @@ packages:engines: {node: '>=20.16.0'}hasBin: true+ resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==}++ resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==}+resolution: {integrity: sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw==}engines: {node: '>=14.16'}+ resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==}+resolution: {integrity: sha512-l63NF9y/cLROq/yqKXSLtcMeeyOfnSQlfMSlzFt/K73oIaD8DGaQWd7Z34X9GPiKqP5rbSh84Hl4bOlLcjiSrQ==}@@ -2878,10 +2968,28 @@ packages:resolution: {integrity: sha512-lBN9zLN/oAf68o3zNXYrdCt1kP8WsiGW8Oo2ka41b2IM5JL/S1CTyX1rW0mb/zSuJun0ZUrDxx4sqvYS2FWzPA==}+ resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==}++ resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}+resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==}engines: {node: '>=12.0.0'}+ resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==}+ engines: {node: ^18.0.0 || >=20.0.0}++ resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}+ engines: {node: '>=14.0.0'}++ resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==}+ engines: {node: '>=14.0.0'}+resolution: {integrity: sha512-ZjCZK0rppSBu7rjHYDYsEaMOIbbT+nWF57hKkv4IUmZWBNrBWBOjIElc0mKRgLM8bm7x/BBlof6t2gi/Oq/Asw==}@@ -2957,6 +3065,11 @@ packages:resolution: {integrity: sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==}+ resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}+ hasBin: true+resolution: {integrity: sha512-cYj0LRuLV2c2sMqhqhGpaO3LretdtMn/BVX4cPLanIZuwwrkVl+lK84E/miEXkCHWXuq65rhNN4rXsBcOB3S4w==}peerDependencies:@@ -3013,6 +3126,34 @@ packages:vite:optional: true+ resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==}+ engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}+ hasBin: true+ peerDependencies:+ '@edge-runtime/vm': '*'+ '@types/debug': ^4.1.12+ '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0+ '@vitest/browser': 3.2.4+ '@vitest/ui': 3.2.4+ happy-dom: '*'+ jsdom: '*'+ peerDependenciesMeta:+ '@edge-runtime/vm':+ optional: true+ '@types/debug':+ optional: true+ '@types/node':+ optional: true+ '@vitest/browser':+ optional: true+ '@vitest/ui':+ optional: true+ happy-dom:+ optional: true+ jsdom:+ optional: true+resolution: {integrity: sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A==}engines: {node: 20 || >=22}@@ -3043,6 +3184,11 @@ packages:resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==}+ resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==}+ engines: {node: '>=8'}+ hasBin: true+resolution: {integrity: sha512-l4U4iT5H8jNV6+EK23ExnUV2z6JvqQtQPrT8XCm4G8RpwC9EPpYTOO9s/ImMPJKe1WSbQUQoJ4k8Nd83fz8skQ==}engines: {node: '>=16'}@@ -4432,6 +4578,11 @@ snapshots:dependencies:'@babel/types': 7.29.0+ '@types/[email protected]':+ dependencies:+ '@types/deep-eql': 4.0.2+ assertion-error: 2.0.1+'@types/[email protected]': {}'@types/[email protected]': {}@@ -4456,6 +4607,8 @@ snapshots:'@types/[email protected]': {}+ '@types/[email protected]': {}+'@types/[email protected]': {}'@types/[email protected]':@@ -4501,6 +4654,48 @@ snapshots:transitivePeerDependencies:- supports-color+ '@vitest/[email protected]':+ dependencies:+ '@types/chai': 5.2.3+ '@vitest/spy': 3.2.4+ '@vitest/utils': 3.2.4+ chai: 5.3.3+ tinyrainbow: 2.0.0++ '@vitest/[email protected]([email protected](@types/[email protected])([email protected])([email protected])([email protected]))':+ dependencies:+ '@vitest/spy': 3.2.4+ estree-walker: 3.0.3+ magic-string: 0.30.21+ optionalDependencies:++ '@vitest/[email protected]':+ dependencies:+ tinyrainbow: 2.0.0++ '@vitest/[email protected]':+ dependencies:+ '@vitest/utils': 3.2.4+ pathe: 2.0.3+ strip-literal: 3.1.0++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 3.2.4+ magic-string: 0.30.21+ pathe: 2.0.3++ '@vitest/[email protected]':+ dependencies:+ tinyspy: 4.0.4++ '@vitest/[email protected]':+ dependencies:+ '@vitest/pretty-format': 3.2.4+ loupe: 3.2.1+ tinyrainbow: 2.0.0+dependencies:event-target-shim: 5.0.1@@ -4520,6 +4715,8 @@ snapshots:+ [email protected]: {}+dependencies:tslib: 2.8.1@@ -4557,6 +4754,8 @@ snapshots:+ [email protected]: {}+dependencies:es-errors: 1.3.0@@ -4564,8 +4763,18 @@ snapshots:+ dependencies:+ assertion-error: 2.0.1+ check-error: 2.1.3+ deep-eql: 5.0.2+ loupe: 3.2.1+ pathval: 2.0.1++ [email protected]: {}+dependencies:boolbase: 1.0.0@@ -4687,6 +4896,8 @@ snapshots:+ [email protected]: {}+@@ -4757,6 +4968,8 @@ snapshots:+ [email protected]: {}+dependencies:es-errors: 1.3.0@@ -4864,10 +5077,16 @@ snapshots:+ dependencies:+ '@types/estree': 1.0.8++ [email protected]: {}+@@ -5030,6 +5249,8 @@ snapshots:+ [email protected]: {}+dependencies:argparse: 2.0.1@@ -5128,6 +5349,8 @@ snapshots:lightningcss-win32-arm64-msvc: 1.31.1lightningcss-win32-x64-msvc: 1.31.1+ [email protected]: {}+dependencies:yallist: 3.1.1@@ -5267,6 +5490,8 @@ snapshots:+ [email protected]: {}+@@ -5447,6 +5672,8 @@ snapshots:+ [email protected]: {}+@@ -5475,8 +5702,16 @@ snapshots:+ [email protected]: {}++ [email protected]: {}++ dependencies:+ js-tokens: 9.0.1+@@ -5489,11 +5724,21 @@ snapshots:+ [email protected]: {}++ [email protected]: {}+dependencies:fdir: 6.5.0([email protected])picomatch: 4.0.3+ [email protected]: {}++ [email protected]: {}++ [email protected]: {}+@@ -5569,6 +5814,27 @@ snapshots:d3-time: 3.1.0d3-timer: 3.0.1+ [email protected](@types/[email protected])([email protected])([email protected])([email protected]):+ dependencies:+ cac: 6.7.14+ debug: 4.4.3+ es-module-lexer: 1.7.0+ pathe: 2.0.3+ transitivePeerDependencies:+ - '@types/node'+ - jiti+ - less+ - lightningcss+ - sass+ - sass-embedded+ - stylus+ - sugarss+ - supports-color+ - terser+ - tsx+ - yaml+[email protected]([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])):dependencies:debug: 4.4.3@@ -5599,6 +5865,47 @@ snapshots:optionalDependencies:+ [email protected](@types/[email protected])([email protected])([email protected])([email protected]):+ dependencies:+ '@types/chai': 5.2.3+ '@vitest/expect': 3.2.4+ '@vitest/mocker': 3.2.4([email protected](@types/[email protected])([email protected])([email protected])([email protected]))+ '@vitest/pretty-format': 3.2.4+ '@vitest/runner': 3.2.4+ '@vitest/snapshot': 3.2.4+ '@vitest/spy': 3.2.4+ '@vitest/utils': 3.2.4+ chai: 5.3.3+ debug: 4.4.3+ expect-type: 1.3.0+ magic-string: 0.30.21+ pathe: 2.0.3+ picomatch: 4.0.3+ std-env: 3.10.0+ tinybench: 2.9.0+ tinyexec: 0.3.2+ tinyglobby: 0.2.15+ tinypool: 1.1.1+ tinyrainbow: 2.0.0+ vite-node: 3.2.4(@types/[email protected])([email protected])([email protected])([email protected])+ why-is-node-running: 2.3.0+ optionalDependencies:+ '@types/node': 22.19.11+ transitivePeerDependencies:+ - jiti+ - less+ - lightningcss+ - msw+ - sass+ - sass-embedded+ - stylus+ - sugarss+ - supports-color+ - terser+ - tsx+ - yaml+@@ -5620,6 +5927,11 @@ snapshots:tr46: 0.0.3webidl-conversions: 3.0.1+ dependencies:+ siginfo: 2.0.0+ stackback: 0.0.2+optionalDependencies:'@cloudflare/workerd-darwin-64': 1.20260219.0diff --git a/src/server/lib/audit/url-policy.test.ts b/src/server/lib/audit/url-policy.test.tsnew file mode 100644index 00000000..f41fbaea--- /dev/null+++ b/src/server/lib/audit/url-policy.test.ts@@ -0,0 +1,50 @@+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { AppError } from "@/server/lib/errors";+import { normalizeAndValidateStartUrl } from "@/server/lib/audit/url-policy";++describe("normalizeAndValidateStartUrl", () => {+ beforeEach(() => {+ vi.stubGlobal("fetch", vi.fn());+ });++ afterEach(() => {+ vi.unstubAllGlobals();+ });++ it("adds https when protocol is missing and strips hash", async () => {+ vi.mocked(fetch).mockResolvedValue(+ new Response(JSON.stringify({ Status: 0, Answer: [] }), {+ status: 200,+ headers: { "content-type": "application/dns-json" },+ }),+ );++ await expect(+ normalizeAndValidateStartUrl("example.com/path#section"),+ ).resolves.toBe("https://example.com/path");+ });++ it("blocks localhost-like targets", async () => {+ await expect(+ normalizeAndValidateStartUrl("http://localhost:3000"),+ ).rejects.toMatchObject({+ code: "CRAWL_TARGET_BLOCKED",+ } satisfies Partial<AppError>);+ });++ it("blocks private ip targets", async () => {+ await expect(+ normalizeAndValidateStartUrl("http://192.168.0.10"),+ ).rejects.toMatchObject({+ code: "CRAWL_TARGET_BLOCKED",+ } satisfies Partial<AppError>);+ });++ it("rejects invalid URL input", async () => {+ await expect(+ normalizeAndValidateStartUrl("not a url"),+ ).rejects.toMatchObject({+ code: "VALIDATION_ERROR",+ } satisfies Partial<AppError>);+ });+});diff --git a/src/server/lib/audit/url-utils.test.ts b/src/server/lib/audit/url-utils.test.tsnew file mode 100644index 00000000..7a32366e--- /dev/null+++ b/src/server/lib/audit/url-utils.test.ts@@ -0,0 +1,62 @@+import { describe, expect, it } from "vitest";+import {+ detectUrlTemplate,+ getOrigin,+ isSameOrigin,+ normalizeUrl,+} from "@/server/lib/audit/url-utils";++describe("normalizeUrl", () => {+ it("normalizes host/query/hash/trailing slash", () => {+ const value = normalizeUrl(+ "https://Example.COM/path/?b=2&a=1#section",+ "https://fallback.com",+ );++ expect(value).toBe("https://example.com/path/?a=1&b=2");+ });++ it("returns null for unsupported protocol", () => {+ expect(normalizeUrl("mailto:[email protected]")).toBeNull();+ });+});++describe("isSameOrigin", () => {+ it("accepts www host equivalence", () => {+ expect(+ isSameOrigin("https://www.example.com/products", "https://example.com"),+ ).toBe(true);+ });++ it("allows http to https upgrade on default ports", () => {+ expect(isSameOrigin("https://example.com/page", "http://example.com")).toBe(+ true,+ );+ });++ it("rejects mismatched hosts", () => {+ expect(isSameOrigin("https://example.org", "https://example.com")).toBe(+ false,+ );+ });+});++describe("detectUrlTemplate", () => {+ it("maps dynamic path segments", () => {+ expect(detectUrlTemplate("/blog/2026-03-01/my-great-post")).toBe(+ "/blog/:date/:slug",+ );+ });++ it("maps numeric id segments", () => {+ expect(detectUrlTemplate("/products/12345")).toBe("/products/:id");+ });+});++describe("getOrigin", () => {+ it("returns URL origin", () => {+ expect(getOrigin("https://example.com:8080/path?q=1")).toBe(+ "https://example.com:8080",+ );+ });+});diff --git a/src/shared/json.test.ts b/src/shared/json.test.tsnew file mode 100644index 00000000..30808d85--- /dev/null+++ b/src/shared/json.test.ts@@ -0,0 +1,30 @@+import { describe, expect, it } from "vitest";+import { z } from "zod";+import { jsonCodec } from "@/shared/json";++describe("jsonCodec", () => {+ const schema = z.object({+ name: z.string(),+ count: z.number().int().nonnegative(),+ });++ const codec = jsonCodec(schema);++ it("parses valid JSON that matches schema", () => {+ const parsed = codec.parse('{"name":"open-seo","count":2}');+ expect(parsed).toEqual({ name: "open-seo", count: 2 });+ });++ it("throws on invalid JSON", () => {+ expect(() => codec.parse('{"name":"open-seo"')).toThrowError();+ });++ it("throws when JSON does not match schema", () => {+ expect(() => codec.parse('{"name":"open-seo","count":"2"}')).toThrowError();+ });++ it("encodes typed values to JSON", () => {+ const encoded = codec.encode({ name: "open-seo", count: 5 });+ expect(encoded).toBe('{"name":"open-seo","count":5}');+ });+});diff --git a/vitest.config.ts b/vitest.config.tsnew file mode 100644index 00000000..9857cb40--- /dev/null+++ b/vitest.config.ts@@ -0,0 +1,12 @@+import { defineConfig } from "vitest/config";+import tsConfigPaths from "vite-tsconfig-paths";++export default defineConfig({+ plugins: [tsConfigPaths()],+ test: {+ environment: "node",+ include: ["src/**/*.test.ts"],+ restoreMocks: true,+ clearMocks: true,+ },+});