Files
wotra/web/vite.config.ts
Andreas Schneider 6c4f78d101 chore(web): add Vitest; add dayCapabilities helper with full test coverage
- Install vitest + jsdom
- Add test/test:watch scripts to package.json
- Add test:web and test:all tasks to mise.toml
- Add dayCapabilities() to utils.ts — single source of truth for
  what actions are permitted per day (future/today/past, open/closed)
- Add DayCapabilities interface to utils.ts
- 11 unit tests: dayCapabilities (5 cases), weekDayKeys (3 cases),
  isWorkday (3 cases)
2026-04-30 19:03:04 +02:00

55 lines
1.3 KiB
TypeScript

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import { VitePWA } from 'vite-plugin-pwa';
export default defineConfig({
plugins: [
sveltekit(),
VitePWA({
registerType: 'autoUpdate',
strategies: 'generateSW',
injectRegister: 'auto',
workbox: {
globPatterns: ['**/*.{js,css,html,svg,png,ico,woff,woff2}'],
navigateFallback: 'index.html',
navigateFallbackDenylist: [/^\/api/, /^\/healthz/],
runtimeCaching: [
{
urlPattern: /^\/api\//,
handler: 'NetworkFirst',
options: {
cacheName: 'api-cache',
networkTimeoutSeconds: 5,
cacheableResponse: { statuses: [0, 200] }
}
}
]
},
manifest: {
name: 'Wotra — Working Time Tracker',
short_name: 'Wotra',
description: 'Track your working hours, close days and weeks, compute overtime.',
theme_color: '#1a1a2e',
background_color: '#f8f9fa',
display: 'standalone',
start_url: '/',
icons: [
{ src: '/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/icon-512.png', sizes: '512x512', type: 'image/png' }
]
}
})
],
server: {
proxy: {
'/api': 'http://localhost:8080',
'/healthz': 'http://localhost:8080'
}
},
test: {
environment: 'jsdom',
globals: true,
include: ['src/**/*.test.ts']
}
});