feat(nutriphi): prepare for production release with tests and improved UX

- Remove broken header links to non-existent settings/profile pages
- Replace header links with settings page link
- Remove TODO comments for credit system in analysis controller
- Add comprehensive error handling with German messages in meals store
- Add loading states, retry buttons, and error displays in UI components
- Create new settings page with daily goals editor
- Add 99 tests across backend, web, and shared packages:
  - Backend: MealService, GoalsService, StatsService, FavoritesService,
    RecommendationsService, nutrition.utils (Jest)
  - Web: API client tests with mocks (Vitest)
  - Shared: utility function tests (Vitest)
- Set up test infrastructure (Jest for NestJS, Vitest for SvelteKit)
This commit is contained in:
Till-JS 2026-01-28 15:23:35 +01:00
parent ee630158c5
commit 3ff8d3833b
28 changed files with 2470 additions and 119 deletions

View file

@ -0,0 +1,14 @@
module.exports = {
moduleFileExtensions: ['js', 'json', 'ts'],
rootDir: 'src',
testRegex: '.*\\.spec\\.ts$',
transform: {
'^.+\\.(t|j)s$': 'ts-jest',
},
collectCoverageFrom: ['**/*.(t|j)s', '!**/*.module.ts', '!**/main.ts', '!**/db/**'],
coverageDirectory: '../coverage',
testEnvironment: 'node',
moduleNameMapper: {
'^@nutriphi/shared$': '<rootDir>/../../packages/shared/src',
},
};

View file

@ -12,6 +12,10 @@
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"type-check": "tsc --noEmit",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:e2e": "jest --config ./test/jest-e2e.json",
"migration:generate": "drizzle-kit generate",
"migration:run": "tsx src/db/migrate.ts",
"db:push": "drizzle-kit push",
@ -38,15 +42,19 @@
"devDependencies": {
"@nestjs/cli": "^10.4.9",
"@nestjs/schematics": "^10.2.3",
"@nestjs/testing": "^10.4.15",
"@types/express": "^5.0.0",
"@types/jest": "^29.5.14",
"@types/node": "^22.10.2",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"prettier": "^3.4.2",
"source-map-support": "^0.5.21",
"ts-jest": "^29.2.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",

View file

@ -24,7 +24,6 @@ export class AnalysisController {
@Post('photo')
async analyzePhoto(@CurrentUser() _user: CurrentUserData, @Body() dto: AnalyzePhotoDto) {
// TODO: Deduct credits from user account
try {
return await this.analysisService.analyzePhoto(dto.imageBase64, dto.mimeType);
} catch (error) {
@ -36,7 +35,6 @@ export class AnalysisController {
@Post('text')
async analyzeText(@CurrentUser() _user: CurrentUserData, @Body() dto: AnalyzeTextDto) {
// TODO: Deduct credits from user account
try {
return await this.analysisService.analyzeText(dto.description);
} catch (error) {

View file

@ -0,0 +1,168 @@
import { Test, TestingModule } from '@nestjs/testing';
import { FavoritesService } from './favorites.service';
import { DATABASE_CONNECTION } from '../db/database.module';
describe('FavoritesService', () => {
let service: FavoritesService;
let mockDb: any;
const mockFavorite = {
id: 'fav-1',
userId: 'user-1',
name: 'Lieblings-Spaghetti',
nutrition: { calories: 650, protein: 25, carbohydrates: 80, fat: 20 },
usageCount: 5,
createdAt: new Date(),
updatedAt: new Date(),
};
beforeEach(async () => {
mockDb = {
select: jest.fn().mockReturnThis(),
from: jest.fn().mockReturnThis(),
where: jest.fn().mockReturnThis(),
orderBy: jest.fn().mockResolvedValue([mockFavorite]),
limit: jest.fn().mockResolvedValue([mockFavorite]),
insert: jest.fn().mockReturnThis(),
values: jest.fn().mockReturnThis(),
returning: jest.fn().mockResolvedValue([mockFavorite]),
update: jest.fn().mockReturnThis(),
set: jest.fn().mockReturnThis(),
delete: jest.fn().mockReturnThis(),
};
const module: TestingModule = await Test.createTestingModule({
providers: [
FavoritesService,
{
provide: DATABASE_CONNECTION,
useValue: mockDb,
},
],
}).compile();
service = module.get<FavoritesService>(FavoritesService);
});
describe('findAll', () => {
it('should return all favorites ordered by usage count', async () => {
const favorites = [
{ ...mockFavorite, id: 'fav-1', usageCount: 10 },
{ ...mockFavorite, id: 'fav-2', usageCount: 5 },
];
mockDb.orderBy.mockResolvedValueOnce(favorites);
const result = await service.findAll('user-1');
expect(mockDb.select).toHaveBeenCalled();
expect(result).toHaveLength(2);
expect(result[0].usageCount).toBeGreaterThan(result[1].usageCount);
});
it('should return empty array when no favorites', async () => {
mockDb.orderBy.mockResolvedValueOnce([]);
const result = await service.findAll('user-1');
expect(result).toEqual([]);
});
});
describe('create', () => {
it('should create a favorite with usageCount 0', async () => {
const newFavorite = { ...mockFavorite, usageCount: 0 };
mockDb.returning.mockResolvedValueOnce([newFavorite]);
const result = await service.create('user-1', {
name: 'Lieblings-Spaghetti',
description: 'Leckere Spaghetti mit Bolognese',
mealType: 'lunch',
nutrition: { calories: 650, protein: 25, carbohydrates: 80, fat: 20 },
});
expect(mockDb.insert).toHaveBeenCalled();
expect(mockDb.values).toHaveBeenCalledWith(
expect.objectContaining({ usageCount: 0, userId: 'user-1' })
);
expect(result.usageCount).toBe(0);
});
});
describe('incrementUsage', () => {
it('should increment usage count', async () => {
const updatedFavorite = { ...mockFavorite, usageCount: 6 };
mockDb.returning.mockResolvedValueOnce([updatedFavorite]);
const result = await service.incrementUsage('user-1', 'fav-1');
expect(mockDb.update).toHaveBeenCalled();
expect(result?.usageCount).toBe(6);
});
it('should return null if favorite not found', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.incrementUsage('user-1', 'fav-999');
expect(result).toBeNull();
});
it('should not increment for wrong user', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.incrementUsage('user-2', 'fav-1');
expect(result).toBeNull();
});
});
describe('delete', () => {
it('should delete favorite and return deleted record', async () => {
mockDb.returning.mockResolvedValueOnce([mockFavorite]);
const result = await service.delete('user-1', 'fav-1');
expect(mockDb.delete).toHaveBeenCalled();
expect(result).toEqual(mockFavorite);
});
it('should return undefined if not found', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.delete('user-1', 'fav-999');
expect(result).toBeUndefined();
});
});
describe('update', () => {
it('should update favorite fields', async () => {
const updatedFavorite = { ...mockFavorite, name: 'Neue Spaghetti' };
mockDb.returning.mockResolvedValueOnce([updatedFavorite]);
const result = await service.update('user-1', 'fav-1', { name: 'Neue Spaghetti' });
expect(mockDb.update).toHaveBeenCalled();
expect(result?.name).toBe('Neue Spaghetti');
});
it('should set updatedAt timestamp', async () => {
const before = new Date();
mockDb.returning.mockResolvedValueOnce([{ ...mockFavorite, updatedAt: new Date() }]);
await service.update('user-1', 'fav-1', { name: 'Updated' });
expect(mockDb.set).toHaveBeenCalledWith(
expect.objectContaining({ updatedAt: expect.any(Date) })
);
});
it('should return undefined if not found', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.update('user-1', 'fav-999', { name: 'Updated' });
expect(result).toBeUndefined();
});
});
});

View file

@ -0,0 +1,112 @@
import { Test, TestingModule } from '@nestjs/testing';
import { GoalsService } from './goals.service';
import { DATABASE_CONNECTION } from '../db/database.module';
describe('GoalsService', () => {
let service: GoalsService;
let mockDb: any;
const mockGoals = {
id: 'goal-1',
userId: 'user-1',
dailyCalories: 2000,
dailyProtein: 50,
dailyCarbs: 275,
dailyFat: 78,
dailyFiber: 28,
createdAt: new Date('2024-01-01'),
updatedAt: new Date('2024-01-01'),
};
beforeEach(async () => {
mockDb = {
select: jest.fn().mockReturnThis(),
from: jest.fn().mockReturnThis(),
where: jest.fn().mockReturnThis(),
limit: jest.fn().mockResolvedValue([mockGoals]),
insert: jest.fn().mockReturnThis(),
values: jest.fn().mockReturnThis(),
returning: jest.fn().mockResolvedValue([mockGoals]),
update: jest.fn().mockReturnThis(),
set: jest.fn().mockReturnThis(),
delete: jest.fn().mockReturnThis(),
};
const module: TestingModule = await Test.createTestingModule({
providers: [
GoalsService,
{
provide: DATABASE_CONNECTION,
useValue: mockDb,
},
],
}).compile();
service = module.get<GoalsService>(GoalsService);
});
describe('getGoals', () => {
it('should return goals for a user', async () => {
const result = await service.getGoals('user-1');
expect(mockDb.select).toHaveBeenCalled();
expect(result).toEqual(mockGoals);
});
it('should return null if no goals found', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.getGoals('user-2');
expect(result).toBeNull();
});
});
describe('createOrUpdate', () => {
const newGoalsData = {
dailyCalories: 2500,
dailyProtein: 100,
dailyCarbs: 300,
dailyFat: 80,
dailyFiber: 30,
};
it('should create new goals if none exist', async () => {
mockDb.limit.mockResolvedValueOnce([]); // getGoals returns null
const result = await service.createOrUpdate('user-1', newGoalsData);
expect(mockDb.insert).toHaveBeenCalled();
expect(result).toEqual(mockGoals);
});
it('should update existing goals', async () => {
const updatedGoals = { ...mockGoals, ...newGoalsData };
mockDb.returning.mockResolvedValueOnce([updatedGoals]);
const result = await service.createOrUpdate('user-1', newGoalsData);
expect(mockDb.update).toHaveBeenCalled();
expect(result).toEqual(updatedGoals);
});
});
describe('delete', () => {
it('should delete goals and return deleted record', async () => {
mockDb.returning.mockResolvedValueOnce([mockGoals]);
const result = await service.delete('user-1');
expect(mockDb.delete).toHaveBeenCalled();
expect(result).toEqual(mockGoals);
});
it('should return undefined if no goals to delete', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.delete('user-2');
expect(result).toBeUndefined();
});
});
});

View file

@ -0,0 +1,221 @@
import { Test, TestingModule } from '@nestjs/testing';
import { MealService } from './meal.service';
import { DATABASE_CONNECTION } from '../db/database.module';
describe('MealService', () => {
let service: MealService;
let mockDb: any;
const mockMeal = {
id: 'meal-1',
userId: 'user-1',
date: new Date('2024-01-15T12:00:00Z'),
mealType: 'lunch',
inputType: 'photo',
description: 'Spaghetti Bolognese',
confidence: 0.95,
createdAt: new Date(),
updatedAt: new Date(),
};
const mockNutrition = {
id: 'nutrition-1',
mealId: 'meal-1',
calories: 650,
protein: 25,
carbohydrates: 80,
fat: 20,
fiber: 5,
sugar: 8,
};
beforeEach(async () => {
mockDb = {
select: jest.fn().mockReturnThis(),
from: jest.fn().mockReturnThis(),
leftJoin: jest.fn().mockReturnThis(),
where: jest.fn().mockReturnThis(),
orderBy: jest.fn().mockReturnThis(),
limit: jest.fn().mockResolvedValue([{ meals: mockMeal, meal_nutrition: mockNutrition }]),
insert: jest.fn().mockReturnThis(),
values: jest.fn().mockReturnThis(),
returning: jest.fn(),
update: jest.fn().mockReturnThis(),
set: jest.fn().mockReturnThis(),
delete: jest.fn().mockReturnThis(),
};
const module: TestingModule = await Test.createTestingModule({
providers: [
MealService,
{
provide: DATABASE_CONNECTION,
useValue: mockDb,
},
],
}).compile();
service = module.get<MealService>(MealService);
});
describe('create', () => {
it('should create a meal with nutrition data', async () => {
mockDb.returning
.mockResolvedValueOnce([mockMeal]) // First call for meal insert
.mockResolvedValueOnce([mockNutrition]); // Second call for nutrition insert
const mealData = {
date: new Date(),
mealType: 'lunch',
inputType: 'photo',
description: 'Spaghetti Bolognese',
confidence: 0.95,
};
const nutritionData = {
calories: 650,
protein: 25,
carbohydrates: 80,
fat: 20,
};
const result = await service.create('user-1', mealData as any, nutritionData as any);
expect(mockDb.insert).toHaveBeenCalledTimes(2);
expect(result).toEqual({ ...mockMeal, nutrition: mockNutrition });
});
});
describe('findByDate', () => {
it('should return meals for a specific date', async () => {
mockDb.orderBy.mockResolvedValueOnce([{ meals: mockMeal, meal_nutrition: mockNutrition }]);
const result = await service.findByDate('user-1', new Date('2024-01-15'));
expect(mockDb.select).toHaveBeenCalled();
expect(result).toHaveLength(1);
expect(result[0]).toEqual({ ...mockMeal, nutrition: mockNutrition });
});
it('should return empty array when no meals found', async () => {
mockDb.orderBy.mockResolvedValueOnce([]);
const result = await service.findByDate('user-1', new Date('2024-01-16'));
expect(result).toEqual([]);
});
it('should handle meals without nutrition data', async () => {
mockDb.orderBy.mockResolvedValueOnce([{ meals: mockMeal, meal_nutrition: null }]);
const result = await service.findByDate('user-1', new Date('2024-01-15'));
expect(result[0].nutrition).toBeNull();
});
});
describe('findByDateRange', () => {
it('should return meals within date range', async () => {
const meal1 = { ...mockMeal, id: 'meal-1', date: new Date('2024-01-15') };
const meal2 = { ...mockMeal, id: 'meal-2', date: new Date('2024-01-16') };
mockDb.orderBy.mockResolvedValueOnce([
{ meals: meal2, meal_nutrition: mockNutrition },
{ meals: meal1, meal_nutrition: mockNutrition },
]);
const result = await service.findByDateRange(
'user-1',
new Date('2024-01-15'),
new Date('2024-01-17')
);
expect(result).toHaveLength(2);
});
});
describe('findOne', () => {
it('should return a single meal with nutrition', async () => {
const result = await service.findOne('user-1', 'meal-1');
expect(result).toEqual({ ...mockMeal, nutrition: mockNutrition });
});
it('should return null if meal not found', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.findOne('user-1', 'meal-999');
expect(result).toBeNull();
});
it('should return null if meal belongs to different user', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.findOne('user-2', 'meal-1');
expect(result).toBeNull();
});
});
describe('delete', () => {
it('should delete meal and return deleted record', async () => {
mockDb.returning.mockResolvedValueOnce([mockMeal]);
const result = await service.delete('user-1', 'meal-1');
expect(mockDb.delete).toHaveBeenCalled();
expect(result).toEqual(mockMeal);
});
it('should return undefined if meal not found', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.delete('user-1', 'meal-999');
expect(result).toBeUndefined();
});
it('should not delete meal of different user', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.delete('user-2', 'meal-1');
expect(result).toBeUndefined();
});
});
describe('update', () => {
it('should update meal data', async () => {
const updatedMeal = { ...mockMeal, description: 'Updated description' };
mockDb.returning.mockResolvedValueOnce([updatedMeal]);
mockDb.limit.mockResolvedValueOnce([{ meals: updatedMeal, meal_nutrition: mockNutrition }]);
const result = await service.update('user-1', 'meal-1', {
description: 'Updated description',
});
expect(mockDb.update).toHaveBeenCalled();
expect(result?.description).toBe('Updated description');
});
it('should update meal and nutrition data', async () => {
const updatedMeal = { ...mockMeal, description: 'Updated' };
const updatedNutrition = { ...mockNutrition, calories: 700 };
mockDb.returning.mockResolvedValueOnce([updatedMeal]);
mockDb.limit.mockResolvedValueOnce([
{ meals: updatedMeal, meal_nutrition: updatedNutrition },
]);
const result = await service.update(
'user-1',
'meal-1',
{ description: 'Updated' },
{ calories: 700 }
);
expect(mockDb.update).toHaveBeenCalledTimes(2);
expect(result?.nutrition?.calories).toBe(700);
});
});
});

View file

@ -0,0 +1,225 @@
import { Test, TestingModule } from '@nestjs/testing';
import { RecommendationsService } from './recommendations.service';
import { DATABASE_CONNECTION } from '../db/database.module';
describe('RecommendationsService', () => {
let service: RecommendationsService;
let mockDb: any;
const mockRecommendation = {
id: 'rec-1',
userId: 'user-1',
date: new Date(),
type: 'hint',
priority: 'medium',
message: 'Deine Proteinaufnahme ist heute niedrig.',
nutrient: 'protein',
actionable: 'Füge mehr proteinreiche Lebensmittel hinzu',
dismissed: false,
createdAt: new Date(),
};
beforeEach(async () => {
mockDb = {
select: jest.fn().mockReturnThis(),
from: jest.fn().mockReturnThis(),
where: jest.fn().mockReturnThis(),
orderBy: jest.fn().mockReturnThis(),
limit: jest.fn().mockResolvedValue([mockRecommendation]),
insert: jest.fn().mockReturnThis(),
values: jest.fn().mockReturnThis(),
returning: jest.fn().mockResolvedValue([mockRecommendation]),
update: jest.fn().mockReturnThis(),
set: jest.fn().mockReturnThis(),
};
const module: TestingModule = await Test.createTestingModule({
providers: [
RecommendationsService,
{
provide: DATABASE_CONNECTION,
useValue: mockDb,
},
],
}).compile();
service = module.get<RecommendationsService>(RecommendationsService);
});
describe('findByDate', () => {
it('should return non-dismissed recommendations', async () => {
const recommendations = [mockRecommendation, { ...mockRecommendation, id: 'rec-2' }];
mockDb.limit.mockResolvedValueOnce(recommendations);
const result = await service.findByDate('user-1', new Date());
expect(mockDb.select).toHaveBeenCalled();
expect(result).toHaveLength(2);
});
it('should limit to 10 results', async () => {
await service.findByDate('user-1', new Date());
expect(mockDb.limit).toHaveBeenCalledWith(10);
});
it('should return empty array when no recommendations', async () => {
mockDb.limit.mockResolvedValueOnce([]);
const result = await service.findByDate('user-1', new Date());
expect(result).toEqual([]);
});
});
describe('create', () => {
it('should create a recommendation with dismissed=false', async () => {
const newRec = {
date: new Date(),
type: 'hint' as const,
priority: 'high' as const,
message: 'Test message',
nutrient: 'sugar',
actionable: 'Do something',
};
await service.create('user-1', newRec);
expect(mockDb.insert).toHaveBeenCalled();
expect(mockDb.values).toHaveBeenCalledWith(
expect.objectContaining({ dismissed: false, userId: 'user-1' })
);
});
});
describe('dismiss', () => {
it('should mark recommendation as dismissed', async () => {
const dismissedRec = { ...mockRecommendation, dismissed: true };
mockDb.returning.mockResolvedValueOnce([dismissedRec]);
const result = await service.dismiss('user-1', 'rec-1');
expect(mockDb.update).toHaveBeenCalled();
expect(mockDb.set).toHaveBeenCalledWith({ dismissed: true });
expect(result?.dismissed).toBe(true);
});
it('should return undefined if not found', async () => {
mockDb.returning.mockResolvedValueOnce([]);
const result = await service.dismiss('user-1', 'rec-999');
expect(result).toBeUndefined();
});
});
describe('generateHints', () => {
it('should generate low protein hint', async () => {
const nutritionSummary = { protein: 20, fiber: 25, sugar: 30 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(1);
expect(hints[0].nutrient).toBe('protein');
expect(hints[0].priority).toBe('medium');
expect(hints[0].message).toContain('Proteinaufnahme');
});
it('should generate low fiber hint', async () => {
const nutritionSummary = { protein: 50, fiber: 5, sugar: 30 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(1);
expect(hints[0].nutrient).toBe('fiber');
expect(hints[0].priority).toBe('low');
expect(hints[0].message).toContain('Ballaststoffe');
});
it('should generate high sugar hint', async () => {
const nutritionSummary = { protein: 50, fiber: 25, sugar: 60 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(1);
expect(hints[0].nutrient).toBe('sugar');
expect(hints[0].priority).toBe('high');
expect(hints[0].message).toContain('Zuckeraufnahme');
});
it('should generate multiple hints when applicable', async () => {
const nutritionSummary = { protein: 15, fiber: 5, sugar: 70 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(3);
expect(hints.map((h) => h.nutrient)).toContain('protein');
expect(hints.map((h) => h.nutrient)).toContain('fiber');
expect(hints.map((h) => h.nutrient)).toContain('sugar');
});
it('should not generate hints when nutrition is good', async () => {
const nutritionSummary = { protein: 50, fiber: 30, sugar: 25 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(0);
});
it('should save hints to database', async () => {
const nutritionSummary = { protein: 10, fiber: 25, sugar: 30 };
await service.generateHints('user-1', nutritionSummary);
expect(mockDb.insert).toHaveBeenCalled();
});
it('should handle missing nutrition values', async () => {
const nutritionSummary = {};
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints).toHaveLength(0);
});
it('should include German actionable suggestions', async () => {
const nutritionSummary = { protein: 10 };
const hints = await service.generateHints('user-1', nutritionSummary);
expect(hints[0].actionable).toContain('Hühnchen');
});
it('should check thresholds correctly - protein boundary', async () => {
// Exactly at threshold (25) should NOT trigger
const atThreshold = { protein: 25 };
const hints1 = await service.generateHints('user-1', atThreshold);
expect(hints1).toHaveLength(0);
// Below threshold should trigger
const belowThreshold = { protein: 24 };
const hints2 = await service.generateHints('user-1', belowThreshold);
expect(hints2).toHaveLength(1);
});
it('should check thresholds correctly - fiber boundary', async () => {
const atThreshold = { fiber: 10 };
const hints1 = await service.generateHints('user-1', atThreshold);
expect(hints1).toHaveLength(0);
const belowThreshold = { fiber: 9 };
const hints2 = await service.generateHints('user-1', belowThreshold);
expect(hints2).toHaveLength(1);
});
it('should check thresholds correctly - sugar boundary', async () => {
const atThreshold = { sugar: 50 };
const hints1 = await service.generateHints('user-1', atThreshold);
expect(hints1).toHaveLength(0);
const aboveThreshold = { sugar: 51 };
const hints2 = await service.generateHints('user-1', aboveThreshold);
expect(hints2).toHaveLength(1);
});
});
});

View file

@ -0,0 +1,239 @@
import { Test, TestingModule } from '@nestjs/testing';
import { StatsService } from './stats.service';
import { MealService } from '../meal/meal.service';
import { GoalsService } from '../goals/goals.service';
describe('StatsService', () => {
let service: StatsService;
let mockMealService: jest.Mocked<MealService>;
let mockGoalsService: jest.Mocked<GoalsService>;
const mockGoals = {
id: 'goal-1',
userId: 'user-1',
dailyCalories: 2000,
dailyProtein: 50,
dailyCarbs: 275,
dailyFat: 78,
dailyFiber: 28,
createdAt: new Date(),
updatedAt: new Date(),
};
const createMeal = (
date: Date,
calories: number,
protein: number,
carbs: number,
fat: number
) => ({
id: `meal-${Date.now()}-${Math.random()}`,
userId: 'user-1',
date,
mealType: 'lunch',
inputType: 'text',
description: 'Test meal',
confidence: 0.9,
createdAt: new Date(),
updatedAt: new Date(),
nutrition: { calories, protein, carbohydrates: carbs, fat, fiber: 5, sugar: 10 },
});
beforeEach(async () => {
mockMealService = {
findByDate: jest.fn(),
findByDateRange: jest.fn(),
} as any;
mockGoalsService = {
getGoals: jest.fn(),
} as any;
const module: TestingModule = await Test.createTestingModule({
providers: [
StatsService,
{ provide: MealService, useValue: mockMealService },
{ provide: GoalsService, useValue: mockGoalsService },
],
}).compile();
service = module.get<StatsService>(StatsService);
});
describe('getDailySummary', () => {
it('should return daily summary with meals and progress', async () => {
const meals = [
createMeal(new Date(), 500, 20, 60, 15),
createMeal(new Date(), 700, 30, 80, 25),
];
mockMealService.findByDate.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getDailySummary('user-1', new Date());
expect(result.meals).toHaveLength(2);
expect(result.totalNutrition.calories).toBe(1200);
expect(result.totalNutrition.protein).toBe(50);
expect(result.progress.calories.percentage).toBe(60); // 1200/2000 = 60%
expect(result.progress.protein!.percentage).toBe(100); // 50/50 = 100%
});
it('should use default values when no goals set', async () => {
const meals = [createMeal(new Date(), 1000, 25, 140, 40)];
mockMealService.findByDate.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(null as any);
const result = await service.getDailySummary('user-1', new Date());
expect(result.goals).toBeUndefined();
expect(result.progress.calories.target).toBe(2000); // default
});
it('should handle days with no meals', async () => {
mockMealService.findByDate.mockResolvedValue([]);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getDailySummary('user-1', new Date());
expect(result.meals).toHaveLength(0);
expect(result.totalNutrition.calories).toBe(0);
expect(result.progress.calories.percentage).toBe(0);
});
});
describe('getWeeklyStats', () => {
it('should return weekly stats with daily breakdown', async () => {
const today = new Date();
const meals = [
createMeal(today, 1800, 45, 220, 70),
createMeal(new Date(today.getTime() - 86400000), 2000, 50, 250, 75),
];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
expect(result.days).toHaveLength(7);
expect(result.averages).toBeDefined();
expect(result.trends).toBeDefined();
});
it('should calculate averages correctly', async () => {
const today = new Date('2024-01-15');
const day1 = new Date('2024-01-09'); // 6 days ago
const day2 = new Date('2024-01-10'); // 5 days ago
const meals = [createMeal(day1, 2000, 50, 250, 80), createMeal(day2, 1800, 45, 220, 70)];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
// Average should be based on days with data (2 days)
expect(result.averages.calories).toBe(1900); // (2000+1800)/2
expect(result.averages.protein).toBe(48); // (50+45)/2 rounded
});
it('should detect upward trend', async () => {
const today = new Date('2024-01-15');
const meals = [
// First half (days 0-2) - low calories
createMeal(new Date('2024-01-09'), 1000, 25, 120, 30),
createMeal(new Date('2024-01-10'), 1100, 28, 130, 35),
createMeal(new Date('2024-01-11'), 1050, 26, 125, 32),
// Second half (days 4-6) - high calories (>10% increase)
createMeal(new Date('2024-01-13'), 1500, 40, 180, 50),
createMeal(new Date('2024-01-14'), 1600, 42, 190, 52),
createMeal(new Date('2024-01-15'), 1550, 41, 185, 51),
];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
expect(result.trends.caloriesTrend).toBe('up');
});
it('should detect downward trend', async () => {
const today = new Date('2024-01-15');
const meals = [
// First half - high calories
createMeal(new Date('2024-01-09'), 2000, 50, 250, 80),
createMeal(new Date('2024-01-10'), 2100, 52, 260, 82),
createMeal(new Date('2024-01-11'), 1950, 49, 240, 78),
// Second half - low calories (>10% decrease)
createMeal(new Date('2024-01-13'), 1500, 38, 180, 48),
createMeal(new Date('2024-01-14'), 1400, 35, 170, 45),
createMeal(new Date('2024-01-15'), 1450, 36, 175, 46),
];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
expect(result.trends.caloriesTrend).toBe('down');
});
it('should detect stable trend', async () => {
const today = new Date('2024-01-15');
const meals = [
createMeal(new Date('2024-01-09'), 2000, 50, 250, 80),
createMeal(new Date('2024-01-10'), 2050, 51, 255, 81),
createMeal(new Date('2024-01-11'), 1980, 49, 245, 79),
createMeal(new Date('2024-01-13'), 2020, 50, 252, 80),
createMeal(new Date('2024-01-14'), 2000, 50, 250, 80),
createMeal(new Date('2024-01-15'), 2010, 50, 251, 80),
];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
expect(result.trends.caloriesTrend).toBe('stable');
});
it('should mark goalsMet correctly when within 10% of target', async () => {
// goalsMet = dayCalories >= goals.dailyCalories * 0.9 && dayCalories <= goals.dailyCalories * 1.1
// With dailyCalories = 2000, range is 1800-2200
// 1900 is within this range, so goalsMet should be true
const today = new Date();
today.setHours(23, 59, 59, 0);
// Create a meal that is definitely within the week range
const startDate = new Date(today);
startDate.setDate(startDate.getDate() - 6);
startDate.setHours(0, 0, 0, 0);
// Use the third day of the week for the meal
const mealDate = new Date(startDate);
mealDate.setDate(mealDate.getDate() + 2);
mealDate.setHours(12, 0, 0, 0);
const meals = [createMeal(mealDate, 1900, 50, 250, 80)];
mockMealService.findByDateRange.mockResolvedValue(meals as any);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', today);
// The day with 1900 calories should have goalsMet = true
const dayWithMeals = result.days.find((d) => d.totalCalories > 0);
expect(dayWithMeals).toBeDefined();
expect(dayWithMeals!.totalCalories).toBe(1900);
expect(dayWithMeals!.goalsMet).toBe(true);
});
it('should handle empty week', async () => {
mockMealService.findByDateRange.mockResolvedValue([]);
mockGoalsService.getGoals.mockResolvedValue(mockGoals);
const result = await service.getWeeklyStats('user-1', new Date());
expect(result.days).toHaveLength(7);
expect(result.averages.calories).toBe(0);
result.days.forEach((day) => {
expect(day.mealCount).toBe(0);
expect(day.goalsMet).toBe(false);
});
});
});
});

View file

@ -0,0 +1,177 @@
import { calculateProgress, sumNutrition } from './nutrition.utils';
import { DEFAULT_DAILY_VALUES } from '../types/nutrition.types';
describe('nutrition.utils', () => {
describe('calculateProgress', () => {
it('should calculate progress with default values when no goals provided', () => {
const nutrition = {
calories: 1000,
protein: 25,
carbohydrates: 138,
fat: 39,
};
const progress = calculateProgress(nutrition);
expect(progress.calories.current).toBe(1000);
expect(progress.calories.target).toBe(DEFAULT_DAILY_VALUES.calories);
expect(progress.calories.percentage).toBe(50);
expect(progress.protein!.current).toBe(25);
expect(progress.protein!.target).toBe(DEFAULT_DAILY_VALUES.protein);
expect(progress.protein!.percentage).toBe(50);
});
it('should use custom goals when provided', () => {
const nutrition = { calories: 1500, protein: 75, carbohydrates: 150, fat: 50 };
const goals = {
id: '1',
userId: 'user1',
dailyCalories: 3000,
dailyProtein: 150,
dailyCarbs: 300,
dailyFat: 100,
dailyFiber: 30,
createdAt: new Date(),
updatedAt: new Date(),
};
const progress = calculateProgress(nutrition, goals);
expect(progress.calories.target).toBe(3000);
expect(progress.calories.percentage).toBe(50);
expect(progress.protein!.target).toBe(150);
expect(progress.protein!.percentage).toBe(50);
});
it('should cap percentage at 100%', () => {
const nutrition = { calories: 3000, protein: 200, carbohydrates: 500, fat: 200 };
const progress = calculateProgress(nutrition);
expect(progress.calories.percentage).toBe(100);
expect(progress.protein!.percentage).toBe(100);
});
it('should handle zero values', () => {
const nutrition = { calories: 0, protein: 0, carbohydrates: 0, fat: 0 };
const progress = calculateProgress(nutrition);
expect(progress.calories.current).toBe(0);
expect(progress.calories.percentage).toBe(0);
});
it('should handle missing nutrition values', () => {
const progress = calculateProgress({});
expect(progress.calories.current).toBe(0);
expect(progress.protein!.current).toBe(0);
expect(progress.carbs!.current).toBe(0);
expect(progress.fat!.current).toBe(0);
});
it('should round percentages', () => {
const nutrition = { calories: 333, protein: 17, carbohydrates: 91, fat: 26 };
const progress = calculateProgress(nutrition);
expect(progress.calories.percentage).toBe(17); // 333/2000 = 16.65 -> 17
expect(progress.protein!.percentage).toBe(34); // 17/50 = 34
});
});
describe('sumNutrition', () => {
it('should sum nutrition from multiple meals', () => {
const meals = [
{
nutrition: {
calories: 500,
protein: 20,
carbohydrates: 60,
fat: 15,
fiber: 5,
sugar: 10,
},
},
{
nutrition: { calories: 300, protein: 15, carbohydrates: 40, fat: 10, fiber: 3, sugar: 5 },
},
{
nutrition: { calories: 200, protein: 10, carbohydrates: 25, fat: 8, fiber: 2, sugar: 3 },
},
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(1000);
expect(sum.protein).toBe(45);
expect(sum.carbohydrates).toBe(125);
expect(sum.fat).toBe(33);
expect(sum.fiber).toBe(10);
expect(sum.sugar).toBe(18);
});
it('should handle empty meals array', () => {
const sum = sumNutrition([]);
expect(sum.calories).toBe(0);
expect(sum.protein).toBe(0);
expect(sum.carbohydrates).toBe(0);
expect(sum.fat).toBe(0);
});
it('should handle meals with null nutrition', () => {
const meals = [
{ nutrition: { calories: 500, protein: 20, carbohydrates: 60, fat: 15 } },
{ nutrition: null },
{ nutrition: { calories: 300, protein: 15, carbohydrates: 40, fat: 10 } },
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(800);
expect(sum.protein).toBe(35);
});
it('should handle meals with undefined nutrition', () => {
const meals = [
{ nutrition: { calories: 500, protein: 20, carbohydrates: 60, fat: 15 } },
{},
{ nutrition: { calories: 300, protein: 15, carbohydrates: 40, fat: 10 } },
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(800);
});
it('should handle partial nutrition data', () => {
const meals = [
{ nutrition: { calories: 500 } },
{ nutrition: { protein: 20 } },
{ nutrition: { fat: 10, fiber: 5 } },
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(500);
expect(sum.protein).toBe(20);
expect(sum.fat).toBe(10);
expect(sum.fiber).toBe(5);
expect(sum.carbohydrates).toBe(0);
});
it('should ignore non-numeric values', () => {
const meals = [
{ nutrition: { calories: 500, protein: 'invalid' as any } },
{ nutrition: { calories: 300, protein: 15 } },
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(800);
expect(sum.protein).toBe(15);
});
});
});

View file

@ -11,14 +11,19 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint .",
"format": "prettier --write .",
"type-check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
"type-check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"test": "vitest run",
"test:watch": "vitest",
"test:cov": "vitest run --coverage"
},
"devDependencies": {
"@sveltejs/adapter-node": "^5.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^5.0.0",
"@tailwindcss/vite": "^4.1.7",
"@testing-library/svelte": "^5.2.6",
"@types/node": "^20.0.0",
"jsdom": "^25.0.1",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^5.0.0",
@ -26,7 +31,8 @@
"tailwindcss": "^4.1.7",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^6.0.0"
"vite": "^6.0.0",
"vitest": "^2.1.8"
},
"dependencies": {
"@nutriphi/shared": "workspace:*",

View file

@ -0,0 +1,126 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
// Mock the auth store before importing client
vi.mock('$lib/stores/auth.svelte', () => ({
authStore: {
getAccessToken: vi.fn().mockResolvedValue('test-token'),
},
}));
vi.mock('$env/static/public', () => ({
PUBLIC_BACKEND_URL: 'http://localhost:3023',
}));
describe('ApiClient', () => {
beforeEach(() => {
vi.clearAllMocks();
(global.fetch as any).mockReset();
});
describe('get', () => {
it('should make GET request with auth header', async () => {
const mockResponse = { data: 'test' };
(global.fetch as any).mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve(mockResponse),
});
const { apiClient } = await import('./client');
const result = await apiClient.get('/test');
expect(global.fetch).toHaveBeenCalledWith(
'http://localhost:3023/api/v1/test',
expect.objectContaining({
method: 'GET',
headers: expect.objectContaining({
Authorization: 'Bearer test-token',
}),
})
);
expect(result).toEqual(mockResponse);
});
it('should throw on non-ok response', async () => {
(global.fetch as any).mockResolvedValueOnce({
ok: false,
status: 404,
});
const { apiClient } = await import('./client');
await expect(apiClient.get('/notfound')).rejects.toThrow('API Error: 404');
});
});
describe('post', () => {
it('should make POST request with body', async () => {
const mockResponse = { id: '123' };
(global.fetch as any).mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve(mockResponse),
});
const { apiClient } = await import('./client');
const result = await apiClient.post('/meals', { name: 'Test' });
expect(global.fetch).toHaveBeenCalledWith(
'http://localhost:3023/api/v1/meals',
expect.objectContaining({
method: 'POST',
body: JSON.stringify({ name: 'Test' }),
})
);
expect(result).toEqual(mockResponse);
});
});
describe('patch', () => {
it('should make PATCH request', async () => {
const mockResponse = { id: '123', name: 'Updated' };
(global.fetch as any).mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve(mockResponse),
});
const { apiClient } = await import('./client');
const result = await apiClient.patch('/meals/123', { name: 'Updated' });
expect(global.fetch).toHaveBeenCalledWith(
'http://localhost:3023/api/v1/meals/123',
expect.objectContaining({
method: 'PATCH',
})
);
expect(result).toEqual(mockResponse);
});
});
describe('delete', () => {
it('should make DELETE request', async () => {
(global.fetch as any).mockResolvedValueOnce({
ok: true,
});
const { apiClient } = await import('./client');
await apiClient.delete('/meals/123');
expect(global.fetch).toHaveBeenCalledWith(
'http://localhost:3023/api/v1/meals/123',
expect.objectContaining({
method: 'DELETE',
})
);
});
it('should throw on failed delete', async () => {
(global.fetch as any).mockResolvedValueOnce({
ok: false,
status: 500,
});
const { apiClient } = await import('./client');
await expect(apiClient.delete('/meals/123')).rejects.toThrow('API Error: 500');
});
});
});

View file

@ -2,6 +2,7 @@
import { mealsStore } from '$lib/stores/meals.svelte';
import { onMount } from 'svelte';
import ProgressRing from './ProgressRing.svelte';
import { AlertCircle, RefreshCw } from 'lucide-svelte';
onMount(() => {
mealsStore.fetchDailySummary();
@ -9,6 +10,11 @@
let progress = $derived(mealsStore.dailySummary?.progress);
let caloriePercent = $derived(progress?.calories?.percentage ?? 0);
function retry() {
mealsStore.clearErrors();
mealsStore.fetchDailySummary();
}
</script>
<div class="bg-[var(--color-background-card)] rounded-2xl p-4 border border-[var(--color-border)]">
@ -20,64 +26,88 @@
</span>
</div>
<!-- Calories Ring -->
<div class="flex items-center gap-6">
<ProgressRing
percentage={caloriePercent}
size={100}
strokeWidth={8}
color="var(--color-calories)"
{#if mealsStore.summaryError}
<div
class="bg-red-500/10 border border-red-500/20 rounded-xl p-3 flex items-center gap-2 text-red-400 text-sm"
>
<div class="text-center">
<div class="text-2xl font-bold text-[var(--color-text-primary)]">
{progress?.calories?.current ?? 0}
</div>
<div class="text-xs text-[var(--color-text-secondary)]">
/ {progress?.calories?.target ?? 2000}
</div>
<AlertCircle class="w-4 h-4 flex-shrink-0" />
<span class="flex-1">{mealsStore.summaryError}</span>
<button onclick={retry} class="p-1 hover:bg-red-500/20 rounded transition-colors">
<RefreshCw class="w-4 h-4" />
</button>
</div>
{:else if mealsStore.summaryLoading}
<div class="flex items-center gap-6 animate-pulse">
<div class="w-[100px] h-[100px] rounded-full bg-[var(--color-background-elevated)]"></div>
<div class="flex-1 grid grid-cols-3 gap-2">
{#each [1, 2, 3] as _}
<div class="text-center">
<div class="h-5 bg-[var(--color-background-elevated)] rounded mb-1"></div>
<div class="h-3 bg-[var(--color-background-elevated)] rounded w-12 mx-auto"></div>
</div>
{/each}
</div>
</ProgressRing>
</div>
{:else}
<!-- Calories Ring -->
<div class="flex items-center gap-6">
<ProgressRing
percentage={caloriePercent}
size={100}
strokeWidth={8}
color="var(--color-calories)"
>
<div class="text-center">
<div class="text-2xl font-bold text-[var(--color-text-primary)]">
{progress?.calories?.current ?? 0}
</div>
<div class="text-xs text-[var(--color-text-secondary)]">
/ {progress?.calories?.target ?? 2000}
</div>
</div>
</ProgressRing>
<!-- Macros -->
<div class="flex-1 grid grid-cols-3 gap-2">
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-protein)]">
{progress?.protein?.current ?? 0}g
<!-- Macros -->
<div class="flex-1 grid grid-cols-3 gap-2">
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-protein)]">
{progress?.protein?.current ?? 0}g
</div>
<div class="text-xs text-[var(--color-text-muted)]">Protein</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-protein)] transition-all"
style="width: {progress?.protein?.percentage ?? 0}%"
></div>
</div>
</div>
<div class="text-xs text-[var(--color-text-muted)]">Protein</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-protein)] transition-all"
style="width: {progress?.protein?.percentage ?? 0}%"
></div>
</div>
</div>
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-carbs)]">
{progress?.carbs?.current ?? 0}g
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-carbs)]">
{progress?.carbs?.current ?? 0}g
</div>
<div class="text-xs text-[var(--color-text-muted)]">Carbs</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-carbs)] transition-all"
style="width: {progress?.carbs?.percentage ?? 0}%"
></div>
</div>
</div>
<div class="text-xs text-[var(--color-text-muted)]">Carbs</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-carbs)] transition-all"
style="width: {progress?.carbs?.percentage ?? 0}%"
></div>
</div>
</div>
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-fat)]">
{progress?.fat?.current ?? 0}g
</div>
<div class="text-xs text-[var(--color-text-muted)]">Fett</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-fat)] transition-all"
style="width: {progress?.fat?.percentage ?? 0}%"
></div>
<div class="text-center">
<div class="text-sm font-medium text-[var(--color-fat)]">
{progress?.fat?.current ?? 0}g
</div>
<div class="text-xs text-[var(--color-text-muted)]">Fett</div>
<div class="mt-1 h-1 bg-[var(--color-background-elevated)] rounded-full overflow-hidden">
<div
class="h-full bg-[var(--color-fat)] transition-all"
style="width: {progress?.fat?.percentage ?? 0}%"
></div>
</div>
</div>
</div>
</div>
</div>
{/if}
</div>

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { User, Settings } from 'lucide-svelte';
import { Settings } from 'lucide-svelte';
</script>
<header
@ -14,20 +14,13 @@
<span class="font-semibold text-[var(--color-text-primary)]">NutriPhi</span>
</div>
<div class="flex items-center gap-2">
<a
href="/settings"
class="p-2 rounded-lg hover:bg-[var(--color-background-card)] transition-colors"
>
<Settings class="w-5 h-5 text-[var(--color-text-secondary)]" />
</a>
<a
href="/profile"
class="p-2 rounded-lg hover:bg-[var(--color-background-card)] transition-colors"
>
<User class="w-5 h-5 text-[var(--color-text-secondary)]" />
</a>
</div>
<a
href="/settings"
class="p-2 rounded-lg hover:bg-[var(--color-background-card)] transition-colors"
title="Einstellungen"
>
<Settings class="w-5 h-5 text-[var(--color-text-secondary)]" />
</a>
</div>
</div>
</header>

View file

@ -2,7 +2,9 @@
import { mealsStore } from '$lib/stores/meals.svelte';
import { onMount } from 'svelte';
import { MEAL_TYPE_LABELS } from '@nutriphi/shared';
import { Trash2, Camera, PenLine } from 'lucide-svelte';
import { Trash2, Camera, PenLine, AlertCircle, RefreshCw, Loader2 } from 'lucide-svelte';
let deleting = $state<string | null>(null);
onMount(() => {
mealsStore.fetchTodaysMeals();
@ -10,15 +12,48 @@
async function deleteMeal(id: string) {
if (confirm('Mahlzeit wirklich löschen?')) {
await mealsStore.deleteMeal(id);
deleting = id;
try {
await mealsStore.deleteMeal(id);
} catch {
// Error is handled in store
} finally {
deleting = null;
}
}
}
function retry() {
mealsStore.clearErrors();
mealsStore.fetchTodaysMeals();
}
</script>
<div class="space-y-3">
{#if mealsStore.error}
<div
class="bg-red-500/10 border border-red-500/20 rounded-xl p-4 flex items-center gap-3 text-red-400"
>
<AlertCircle class="w-5 h-5 flex-shrink-0" />
<span class="flex-1 text-sm">{mealsStore.error}</span>
<button onclick={retry} class="p-2 hover:bg-red-500/20 rounded-lg transition-colors">
<RefreshCw class="w-4 h-4" />
</button>
</div>
{/if}
{#if mealsStore.deleteError}
<div
class="bg-red-500/10 border border-red-500/20 rounded-xl p-3 flex items-center gap-2 text-red-400 text-sm"
>
<AlertCircle class="w-4 h-4 flex-shrink-0" />
<span>{mealsStore.deleteError}</span>
</div>
{/if}
{#if mealsStore.loading}
<div class="text-center py-8 text-[var(--color-text-secondary)]">Laden...</div>
{:else if mealsStore.meals.length === 0}
{:else if !mealsStore.error && mealsStore.meals.length === 0}
<div class="text-center py-8">
<p class="text-[var(--color-text-secondary)] mb-2">Noch keine Mahlzeiten heute</p>
<p class="text-sm text-[var(--color-text-muted)]">
@ -65,9 +100,14 @@
</div>
<button
onclick={() => deleteMeal(meal.id)}
class="p-2 rounded-lg hover:bg-[var(--color-background-elevated)] text-[var(--color-text-muted)] hover:text-red-400 transition-colors"
disabled={deleting === meal.id}
class="p-2 rounded-lg hover:bg-[var(--color-background-elevated)] text-[var(--color-text-muted)] hover:text-red-400 transition-colors disabled:opacity-50"
>
<Trash2 class="w-4 h-4" />
{#if deleting === meal.id}
<Loader2 class="w-4 h-4 animate-spin" />
{:else}
<Trash2 class="w-4 h-4" />
{/if}
</button>
</div>
</div>

View file

@ -10,6 +10,9 @@ class MealsStore {
loading = $state(false);
error = $state<string | null>(null);
dailySummary = $state<DailySummary | null>(null);
summaryLoading = $state(false);
summaryError = $state<string | null>(null);
deleteError = $state<string | null>(null);
async fetchTodaysMeals() {
this.loading = true;
@ -18,18 +21,23 @@ class MealsStore {
const today = new Date().toISOString().split('T')[0];
this.meals = await apiClient.get<MealWithNutrition[]>(`/meals?date=${today}`);
} catch (err) {
this.error = err instanceof Error ? err.message : 'Failed to fetch meals';
this.error = err instanceof Error ? err.message : 'Mahlzeiten konnten nicht geladen werden';
} finally {
this.loading = false;
}
}
async fetchDailySummary(date?: Date) {
this.summaryLoading = true;
this.summaryError = null;
try {
const dateStr = (date || new Date()).toISOString().split('T')[0];
this.dailySummary = await apiClient.get<DailySummary>(`/stats/daily?date=${dateStr}`);
} catch (err) {
console.error('Failed to fetch daily summary:', err);
this.summaryError =
err instanceof Error ? err.message : 'Zusammenfassung konnte nicht geladen werden';
} finally {
this.summaryLoading = false;
}
}
@ -46,16 +54,37 @@ class MealsStore {
fiber?: number;
sugar?: number;
}) {
const meal = await apiClient.post<MealWithNutrition>('/meals', mealData);
this.meals = [...this.meals, meal];
await this.fetchDailySummary();
return meal;
this.error = null;
try {
const meal = await apiClient.post<MealWithNutrition>('/meals', mealData);
this.meals = [...this.meals, meal];
await this.fetchDailySummary();
return meal;
} catch (err) {
const message =
err instanceof Error ? err.message : 'Mahlzeit konnte nicht gespeichert werden';
this.error = message;
throw new Error(message);
}
}
async deleteMeal(mealId: string) {
await apiClient.delete(`/meals/${mealId}`);
this.meals = this.meals.filter((m) => m.id !== mealId);
await this.fetchDailySummary();
this.deleteError = null;
try {
await apiClient.delete(`/meals/${mealId}`);
this.meals = this.meals.filter((m) => m.id !== mealId);
await this.fetchDailySummary();
} catch (err) {
this.deleteError =
err instanceof Error ? err.message : 'Mahlzeit konnte nicht gelöscht werden';
throw new Error(this.deleteError);
}
}
clearErrors() {
this.error = null;
this.summaryError = null;
this.deleteError = null;
}
}

View file

@ -6,7 +6,7 @@
import { apiClient } from '$lib/api/client';
import { suggestMealType, MEAL_TYPE_LABELS } from '@nutriphi/shared';
import type { AIAnalysisResult } from '@nutriphi/shared';
import { Camera, ArrowLeft, Loader2, Check } from 'lucide-svelte';
import { Camera, ArrowLeft, Loader2, Check, AlertCircle, X } from 'lucide-svelte';
let inputType = $derived($page.url.searchParams.get('type') || 'photo');
let mealType = $state(suggestMealType());
@ -177,7 +177,18 @@
{/if}
{#if error}
<p class="text-red-400 text-sm mb-4">{error}</p>
<div
class="bg-red-500/10 border border-red-500/20 rounded-xl p-3 mb-4 flex items-center gap-2 text-red-400"
>
<AlertCircle class="w-4 h-4 flex-shrink-0" />
<span class="flex-1 text-sm">{error}</span>
<button
onclick={() => (error = '')}
class="p-1 hover:bg-red-500/20 rounded transition-colors"
>
<X class="w-4 h-4" />
</button>
</div>
{/if}
{#if !analysisResult}

View file

@ -0,0 +1,277 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { onMount } from 'svelte';
import { authStore } from '$lib/stores/auth.svelte';
import { apiClient } from '$lib/api/client';
import { DEFAULT_DAILY_VALUES } from '@nutriphi/shared';
import { ArrowLeft, Save, Loader2, AlertCircle, LogOut, User, Target } from 'lucide-svelte';
interface UserGoals {
dailyCalories: number;
dailyProtein: number;
dailyCarbs: number;
dailyFat: number;
dailyFiber: number;
}
let loading = $state(true);
let saving = $state(false);
let error = $state('');
let success = $state('');
let dailyCalories = $state<number>(DEFAULT_DAILY_VALUES.calories);
let dailyProtein = $state<number>(DEFAULT_DAILY_VALUES.protein);
let dailyCarbs = $state<number>(DEFAULT_DAILY_VALUES.carbohydrates);
let dailyFat = $state<number>(DEFAULT_DAILY_VALUES.fat);
let dailyFiber = $state<number>(DEFAULT_DAILY_VALUES.fiber);
// Redirect if not authenticated
$effect(() => {
if (!authStore.loading && !authStore.isAuthenticated) {
goto('/login');
}
});
onMount(async () => {
try {
const goals = await apiClient.get<UserGoals | null>('/goals');
if (goals) {
dailyCalories = goals.dailyCalories;
dailyProtein = goals.dailyProtein ?? DEFAULT_DAILY_VALUES.protein;
dailyCarbs = goals.dailyCarbs ?? DEFAULT_DAILY_VALUES.carbohydrates;
dailyFat = goals.dailyFat ?? DEFAULT_DAILY_VALUES.fat;
dailyFiber = goals.dailyFiber ?? DEFAULT_DAILY_VALUES.fiber;
}
} catch (err) {
// No goals set yet, use defaults
} finally {
loading = false;
}
});
async function saveGoals() {
error = '';
success = '';
saving = true;
try {
await apiClient.post('/goals', {
dailyCalories,
dailyProtein,
dailyCarbs,
dailyFat,
dailyFiber,
});
success = 'Ziele gespeichert!';
setTimeout(() => (success = ''), 3000);
} catch (err) {
error = err instanceof Error ? err.message : 'Speichern fehlgeschlagen';
} finally {
saving = false;
}
}
async function handleLogout() {
await authStore.signOut();
goto('/login');
}
</script>
<div class="min-h-screen bg-[var(--color-background-page)]">
<!-- Header -->
<header
class="sticky top-0 z-40 bg-[var(--color-background-page)]/95 backdrop-blur border-b border-[var(--color-border)]"
>
<div class="container mx-auto px-4 max-w-lg">
<div class="flex items-center h-14">
<button
onclick={() => goto('/')}
class="p-2 -ml-2 rounded-lg hover:bg-[var(--color-background-card)]"
>
<ArrowLeft class="w-5 h-5 text-[var(--color-text-secondary)]" />
</button>
<h1 class="ml-2 font-semibold text-[var(--color-text-primary)]">Einstellungen</h1>
</div>
</div>
</header>
<main class="container mx-auto px-4 py-6 max-w-lg space-y-6">
<!-- User Info -->
<section
class="bg-[var(--color-background-card)] rounded-xl p-4 border border-[var(--color-border)]"
>
<div class="flex items-center gap-3 mb-4">
<div
class="w-10 h-10 rounded-full bg-[var(--color-primary)]/20 flex items-center justify-center"
>
<User class="w-5 h-5 text-[var(--color-primary)]" />
</div>
<div>
<h2 class="font-semibold text-[var(--color-text-primary)]">Konto</h2>
<p class="text-sm text-[var(--color-text-secondary)]">
{authStore.user?.email ?? 'Nicht angemeldet'}
</p>
</div>
</div>
<button
onclick={handleLogout}
class="w-full py-2.5 px-4 bg-[var(--color-background-elevated)] hover:bg-red-500/20 text-[var(--color-text-secondary)] hover:text-red-400 font-medium rounded-lg transition-colors flex items-center justify-center gap-2"
>
<LogOut class="w-4 h-4" />
Abmelden
</button>
</section>
<!-- Daily Goals -->
<section
class="bg-[var(--color-background-card)] rounded-xl p-4 border border-[var(--color-border)]"
>
<div class="flex items-center gap-3 mb-4">
<div
class="w-10 h-10 rounded-full bg-[var(--color-calories)]/20 flex items-center justify-center"
>
<Target class="w-5 h-5 text-[var(--color-calories)]" />
</div>
<div>
<h2 class="font-semibold text-[var(--color-text-primary)]">Tagesziele</h2>
<p class="text-sm text-[var(--color-text-secondary)]">Passe deine Ziele an</p>
</div>
</div>
{#if loading}
<div class="flex items-center justify-center py-8">
<Loader2 class="w-6 h-6 animate-spin text-[var(--color-text-muted)]" />
</div>
{:else}
<div class="space-y-4">
<!-- Calories -->
<div>
<label
for="calories"
class="block text-sm font-medium text-[var(--color-text-secondary)] mb-1"
>
Kalorien (kcal)
</label>
<input
id="calories"
type="number"
bind:value={dailyCalories}
min="500"
max="10000"
class="w-full px-3 py-2 bg-[var(--color-background-elevated)] border border-[var(--color-border)] rounded-lg text-[var(--color-text-primary)] focus:outline-none focus:border-[var(--color-primary)]"
/>
</div>
<!-- Protein -->
<div>
<label
for="protein"
class="block text-sm font-medium text-[var(--color-text-secondary)] mb-1"
>
Protein (g)
</label>
<input
id="protein"
type="number"
bind:value={dailyProtein}
min="0"
max="500"
class="w-full px-3 py-2 bg-[var(--color-background-elevated)] border border-[var(--color-border)] rounded-lg text-[var(--color-text-primary)] focus:outline-none focus:border-[var(--color-primary)]"
/>
</div>
<!-- Carbs -->
<div>
<label
for="carbs"
class="block text-sm font-medium text-[var(--color-text-secondary)] mb-1"
>
Kohlenhydrate (g)
</label>
<input
id="carbs"
type="number"
bind:value={dailyCarbs}
min="0"
max="1000"
class="w-full px-3 py-2 bg-[var(--color-background-elevated)] border border-[var(--color-border)] rounded-lg text-[var(--color-text-primary)] focus:outline-none focus:border-[var(--color-primary)]"
/>
</div>
<!-- Fat -->
<div>
<label
for="fat"
class="block text-sm font-medium text-[var(--color-text-secondary)] mb-1"
>
Fett (g)
</label>
<input
id="fat"
type="number"
bind:value={dailyFat}
min="0"
max="500"
class="w-full px-3 py-2 bg-[var(--color-background-elevated)] border border-[var(--color-border)] rounded-lg text-[var(--color-text-primary)] focus:outline-none focus:border-[var(--color-primary)]"
/>
</div>
<!-- Fiber -->
<div>
<label
for="fiber"
class="block text-sm font-medium text-[var(--color-text-secondary)] mb-1"
>
Ballaststoffe (g)
</label>
<input
id="fiber"
type="number"
bind:value={dailyFiber}
min="0"
max="100"
class="w-full px-3 py-2 bg-[var(--color-background-elevated)] border border-[var(--color-border)] rounded-lg text-[var(--color-text-primary)] focus:outline-none focus:border-[var(--color-primary)]"
/>
</div>
{#if error}
<div
class="bg-red-500/10 border border-red-500/20 rounded-lg p-3 flex items-center gap-2 text-red-400 text-sm"
>
<AlertCircle class="w-4 h-4 flex-shrink-0" />
<span>{error}</span>
</div>
{/if}
{#if success}
<div
class="bg-green-500/10 border border-green-500/20 rounded-lg p-3 text-green-400 text-sm text-center"
>
{success}
</div>
{/if}
<button
onclick={saveGoals}
disabled={saving}
class="w-full py-3 bg-[var(--color-primary)] hover:bg-[var(--color-primary-hover)] text-white font-medium rounded-lg transition-colors disabled:opacity-50 flex items-center justify-center gap-2"
>
{#if saving}
<Loader2 class="w-5 h-5 animate-spin" />
Speichern...
{:else}
<Save class="w-5 h-5" />
Ziele speichern
{/if}
</button>
</div>
{/if}
</section>
<!-- App Info -->
<section class="text-center text-sm text-[var(--color-text-muted)] py-4">
<p>NutriPhi v1.0.0</p>
<p class="mt-1">KI-gestützte Ernährungsanalyse</p>
</section>
</main>
</div>

View file

@ -0,0 +1,4 @@
export const browser = true;
export const building = false;
export const dev = true;
export const version = 'test';

View file

@ -0,0 +1,9 @@
import { vi } from 'vitest';
export const goto = vi.fn();
export const invalidate = vi.fn();
export const invalidateAll = vi.fn();
export const prefetch = vi.fn();
export const prefetchRoutes = vi.fn();
export const beforeNavigate = vi.fn();
export const afterNavigate = vi.fn();

View file

@ -0,0 +1,17 @@
import { writable, readable } from 'svelte/store';
export const page = readable({
url: new URL('http://localhost'),
params: {},
route: { id: '/' },
status: 200,
error: null,
data: {},
form: null,
});
export const navigating = readable(null);
export const updated = {
subscribe: writable(false).subscribe,
check: async () => false,
};

View file

@ -0,0 +1,2 @@
export const PUBLIC_BACKEND_URL = 'http://localhost:3023';
export const PUBLIC_MANA_CORE_AUTH_URL = 'http://localhost:3001';

View file

@ -0,0 +1,19 @@
import { vi, beforeEach } from 'vitest';
// Mock localStorage
const localStorageMock = {
getItem: vi.fn(),
setItem: vi.fn(),
removeItem: vi.fn(),
clear: vi.fn(),
};
Object.defineProperty(global, 'localStorage', { value: localStorageMock });
// Mock fetch
global.fetch = vi.fn();
// Reset mocks before each test
beforeEach(() => {
vi.clearAllMocks();
localStorageMock.getItem.mockReturnValue(null);
});

View file

@ -0,0 +1,20 @@
import { defineConfig } from 'vitest/config';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import path from 'path';
export default defineConfig({
plugins: [svelte({ hot: !process.env.VITEST })],
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.ts'],
},
resolve: {
alias: {
$lib: path.resolve(__dirname, './src/lib'),
$app: path.resolve(__dirname, './src/test/mocks/app'),
'$env/static/public': path.resolve(__dirname, './src/test/mocks/env/static/public.ts'),
},
},
});

View file

@ -10,7 +10,12 @@
"dev:landing": "pnpm --filter @nutriphi/landing dev",
"db:push": "pnpm --filter @nutriphi/backend db:push",
"db:studio": "pnpm --filter @nutriphi/backend db:studio",
"db:seed": "pnpm --filter @nutriphi/backend db:seed"
"db:seed": "pnpm --filter @nutriphi/backend db:seed",
"test": "pnpm --filter @nutriphi/backend test && pnpm --filter @nutriphi/shared test && pnpm --filter @nutriphi/web test",
"test:backend": "pnpm --filter @nutriphi/backend test",
"test:web": "pnpm --filter @nutriphi/web test",
"test:shared": "pnpm --filter @nutriphi/shared test",
"test:cov": "pnpm --filter @nutriphi/backend test:cov"
},
"devDependencies": {
"typescript": "^5.9.3"

View file

@ -11,10 +11,13 @@
"./constants": "./src/constants/index.ts"
},
"scripts": {
"type-check": "tsc --noEmit"
"type-check": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
},
"devDependencies": {
"typescript": "~5.9.2"
"typescript": "~5.9.2",
"vitest": "^2.1.8"
},
"dependencies": {}
}

View file

@ -0,0 +1,189 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
calculateProgress,
sumNutrition,
formatNutrient,
getProgressColor,
detectDeficiencies,
suggestMealType,
formatDateForDisplay,
isToday,
} from './index';
describe('Shared Utils', () => {
describe('calculateProgress', () => {
it('should calculate progress with default values', () => {
const nutrition = { calories: 1000, protein: 25, carbohydrates: 137, fat: 39 };
const progress = calculateProgress(nutrition);
expect(progress.calories.current).toBe(1000);
expect(progress.calories.target).toBe(2000);
expect(progress.calories.percentage).toBe(50);
});
it('should use custom goals', () => {
const nutrition = { calories: 1500, protein: 75 };
const goals = {
dailyCalories: 3000,
dailyProtein: 150,
dailyCarbs: 300,
dailyFat: 100,
} as any;
const progress = calculateProgress(nutrition, goals);
expect(progress.calories.target).toBe(3000);
expect(progress.calories.percentage).toBe(50);
});
it('should cap percentage at 100', () => {
const nutrition = { calories: 3000 };
const progress = calculateProgress(nutrition);
expect(progress.calories.percentage).toBe(100);
});
it('should handle missing values', () => {
const progress = calculateProgress({});
expect(progress.calories.current).toBe(0);
expect(progress.calories.percentage).toBe(0);
});
});
describe('sumNutrition', () => {
it('should sum multiple meals', () => {
const meals = [
{ nutrition: { calories: 500, protein: 20, carbohydrates: 60, fat: 15 } },
{ nutrition: { calories: 300, protein: 15, carbohydrates: 40, fat: 10 } },
];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(800);
expect(sum.protein).toBe(35);
expect(sum.carbohydrates).toBe(100);
expect(sum.fat).toBe(25);
});
it('should handle null nutrition', () => {
const meals = [{ nutrition: { calories: 500 } }, { nutrition: null }];
const sum = sumNutrition(meals);
expect(sum.calories).toBe(500);
});
it('should handle empty array', () => {
const sum = sumNutrition([]);
expect(sum.calories).toBe(0);
});
});
describe('formatNutrient', () => {
it('should format calories', () => {
expect(formatNutrient('calories', 1234.5)).toBe('1235 kcal');
});
it('should format protein', () => {
expect(formatNutrient('protein', 25.5)).toBe('25.5 g');
});
it('should return dash for undefined', () => {
expect(formatNutrient('calories', undefined)).toBe('-');
});
});
describe('getProgressColor', () => {
it('should return red for low percentage', () => {
expect(getProgressColor(30)).toBe('#EF4444');
});
it('should return orange for medium percentage', () => {
expect(getProgressColor(60)).toBe('#F59E0B');
});
it('should return green for high percentage', () => {
expect(getProgressColor(90)).toBe('#22C55E');
});
it('should return red for over 100%', () => {
expect(getProgressColor(120)).toBe('#EF4444');
});
});
describe('detectDeficiencies', () => {
it('should detect low protein', () => {
const nutrition = { protein: 10 }; // 20% of 50g target
const deficiencies = detectDeficiencies(nutrition);
expect(deficiencies).toContainEqual(expect.objectContaining({ nutrient: 'protein' }));
});
it('should not detect deficiency when above threshold', () => {
const nutrition = { protein: 30 }; // 60% of target
const deficiencies = detectDeficiencies(nutrition);
expect(deficiencies.find((d) => d.nutrient === 'protein')).toBeUndefined();
});
});
describe('suggestMealType', () => {
beforeEach(() => {
vi.useFakeTimers();
});
afterEach(() => {
vi.useRealTimers();
});
it('should suggest breakfast in the morning', () => {
vi.setSystemTime(new Date('2024-01-15T08:00:00'));
expect(suggestMealType()).toBe('breakfast');
});
it('should suggest lunch at noon', () => {
vi.setSystemTime(new Date('2024-01-15T12:00:00'));
expect(suggestMealType()).toBe('lunch');
});
it('should suggest dinner in the evening', () => {
vi.setSystemTime(new Date('2024-01-15T19:00:00'));
expect(suggestMealType()).toBe('dinner');
});
it('should suggest snack at other times', () => {
vi.setSystemTime(new Date('2024-01-15T15:00:00'));
expect(suggestMealType()).toBe('snack');
});
});
describe('formatDateForDisplay', () => {
it('should format date in German', () => {
const date = new Date('2024-01-15');
const formatted = formatDateForDisplay(date, 'de-DE');
expect(formatted).toContain('15');
expect(formatted).toContain('Januar');
});
});
describe('isToday', () => {
it('should return true for today', () => {
expect(isToday(new Date())).toBe(true);
});
it('should return false for yesterday', () => {
const yesterday = new Date();
yesterday.setDate(yesterday.getDate() - 1);
expect(isToday(yesterday)).toBe(false);
});
it('should return false for same day different year', () => {
const lastYear = new Date();
lastYear.setFullYear(lastYear.getFullYear() - 1);
expect(isToday(lastYear)).toBe(false);
});
});
});

View file

@ -0,0 +1,9 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
include: ['src/**/*.{test,spec}.{js,ts}'],
environment: 'node',
globals: true,
},
});

462
pnpm-lock.yaml generated
View file

@ -2095,13 +2095,19 @@ importers:
devDependencies:
'@nestjs/cli':
specifier: ^10.4.9
version: 10.4.9(esbuild@0.27.0)
version: 10.4.9
'@nestjs/schematics':
specifier: ^10.2.3
version: 10.2.3(chokidar@3.6.0)(typescript@5.9.3)
'@nestjs/testing':
specifier: ^10.4.15
version: 10.4.20(@nestjs/common@10.4.20(class-transformer@0.5.1)(class-validator@0.14.3)(reflect-metadata@0.2.2)(rxjs@7.8.2))(@nestjs/core@10.4.20)(@nestjs/platform-express@10.4.20)
'@types/express':
specifier: ^5.0.0
version: 5.0.5
'@types/jest':
specifier: ^29.5.14
version: 29.5.14
'@types/node':
specifier: ^22.10.2
version: 22.19.1
@ -2120,15 +2126,21 @@ importers:
eslint-plugin-prettier:
specifier: ^5.2.1
version: 5.5.4(@types/eslint@9.6.1)(eslint-config-prettier@9.1.2(eslint@9.39.1(jiti@2.6.1)))(eslint@9.39.1(jiti@2.6.1))(prettier@3.6.2)
jest:
specifier: ^29.7.0
version: 29.7.0(@types/node@22.19.1)(ts-node@10.9.2(@types/node@22.19.1)(typescript@5.9.3))
prettier:
specifier: ^3.4.2
version: 3.6.2
source-map-support:
specifier: ^0.5.21
version: 0.5.21
ts-jest:
specifier: ^29.2.5
version: 29.4.5(@babel/core@7.28.5)(@jest/transform@30.2.0)(@jest/types@30.2.0)(babel-jest@30.2.0(@babel/core@7.28.5))(esbuild@0.19.12)(jest-util@30.2.0)(jest@29.7.0(@types/node@22.19.1)(ts-node@10.9.2(@types/node@22.19.1)(typescript@5.9.3)))(typescript@5.9.3)
ts-loader:
specifier: ^9.5.1
version: 9.5.4(typescript@5.9.3)(webpack@5.100.2(esbuild@0.27.0))
version: 9.5.4(typescript@5.9.3)(webpack@5.100.2)
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@22.19.1)(typescript@5.9.3)
@ -2260,9 +2272,15 @@ importers:
'@tailwindcss/vite':
specifier: ^4.1.7
version: 4.1.17(vite@6.4.1(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1))
'@testing-library/svelte':
specifier: ^5.2.6
version: 5.3.1(svelte@5.44.0)(vite@6.4.1(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1))(vitest@2.1.9(@types/node@20.19.25)(jsdom@25.0.1)(lightningcss@1.30.2)(terser@5.44.1))
'@types/node':
specifier: ^20.0.0
version: 20.19.25
jsdom:
specifier: ^25.0.1
version: 25.0.1
prettier:
specifier: ^3.1.1
version: 3.6.2
@ -2287,12 +2305,18 @@ importers:
vite:
specifier: ^6.0.0
version: 6.4.1(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1)
vitest:
specifier: ^2.1.8
version: 2.1.9(@types/node@20.19.25)(jsdom@25.0.1)(lightningcss@1.30.2)(terser@5.44.1)
apps/nutriphi/packages/shared:
devDependencies:
typescript:
specifier: ~5.9.2
version: 5.9.3
vitest:
specifier: ^2.1.8
version: 2.1.9(@types/node@24.10.1)(jsdom@27.2.0)(lightningcss@1.30.2)(terser@5.44.1)
apps/picture:
dependencies:
@ -5223,6 +5247,9 @@ packages:
'@antfu/utils@8.1.1':
resolution: {integrity: sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==}
'@asamuzakjp/css-color@3.2.0':
resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==}
'@asamuzakjp/css-color@4.1.0':
resolution: {integrity: sha512-9xiBAtLn4aNsa4mDnpovJvBn72tNEIACyvlqaNJ+ADemR+yeMJWnBudOi2qGDviJa7SwcDOU/TRh5dnET7qk0w==}
@ -10438,6 +10465,25 @@ packages:
jest:
optional: true
'@testing-library/svelte-core@1.0.0':
resolution: {integrity: sha512-VkUePoLV6oOYwSUvX6ShA8KLnJqZiYMIbP2JW2t0GLWLkJxKGvuH5qrrZBV/X7cXFnLGuFQEC7RheYiZOW68KQ==}
engines: {node: '>=16'}
peerDependencies:
svelte: ^3 || ^4 || ^5 || ^5.0.0-next.0
'@testing-library/svelte@5.3.1':
resolution: {integrity: sha512-8Ez7ZOqW5geRf9PF5rkuopODe5RGy3I9XR+kc7zHh26gBiktLaxTfKmhlGaSHYUOTQE7wFsLMN9xCJVCszw47w==}
engines: {node: '>= 10'}
peerDependencies:
svelte: ^3 || ^4 || ^5 || ^5.0.0-next.0
vite: '*'
vitest: '*'
peerDependenciesMeta:
vite:
optional: true
vitest:
optional: true
'@testing-library/user-event@14.6.1':
resolution: {integrity: sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==}
engines: {node: '>=12', npm: '>=6'}
@ -11194,12 +11240,26 @@ packages:
'@vitest/browser':
optional: true
'@vitest/expect@2.1.9':
resolution: {integrity: sha512-UJCIkTBenHeKT1TTlKMJWy1laZewsRIzYighyYiJKZreqtdxSos/S1t+ktRMQWu2CKqaarrkeszJx1cgC5tGZw==}
'@vitest/expect@3.2.4':
resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==}
'@vitest/expect@4.0.14':
resolution: {integrity: sha512-RHk63V3zvRiYOWAV0rGEBRO820ce17hz7cI2kDmEdfQsBjT2luEKB5tCOc91u1oSQoUOZkSv3ZyzkdkSLD7lKw==}
'@vitest/mocker@2.1.9':
resolution: {integrity: sha512-tVL6uJgoUdi6icpxmdrn5YNo3g3Dxv+IHJBr0GXHaEdTcw3F+cPKnsXFhli6nO+f/6SDKPHEK1UN+k+TQv0Ehg==}
peerDependencies:
msw: ^2.4.9
vite: ^5.0.0
peerDependenciesMeta:
msw:
optional: true
vite:
optional: true
'@vitest/mocker@3.2.4':
resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==}
peerDependencies:
@ -11222,24 +11282,36 @@ packages:
vite:
optional: true
'@vitest/pretty-format@2.1.9':
resolution: {integrity: sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ==}
'@vitest/pretty-format@3.2.4':
resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==}
'@vitest/pretty-format@4.0.14':
resolution: {integrity: sha512-SOYPgujB6TITcJxgd3wmsLl+wZv+fy3av2PpiPpsWPZ6J1ySUYfScfpIt2Yv56ShJXR2MOA6q2KjKHN4EpdyRQ==}
'@vitest/runner@2.1.9':
resolution: {integrity: sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==}
'@vitest/runner@3.2.4':
resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==}
'@vitest/runner@4.0.14':
resolution: {integrity: sha512-BsAIk3FAqxICqREbX8SetIteT8PiaUL/tgJjmhxJhCsigmzzH8xeadtp7LRnTpCVzvf0ib9BgAfKJHuhNllKLw==}
'@vitest/snapshot@2.1.9':
resolution: {integrity: sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==}
'@vitest/snapshot@3.2.4':
resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==}
'@vitest/snapshot@4.0.14':
resolution: {integrity: sha512-aQVBfT1PMzDSA16Y3Fp45a0q8nKexx6N5Amw3MX55BeTeZpoC08fGqEZqVmPcqN0ueZsuUQ9rriPMhZ3Mu19Ag==}
'@vitest/spy@2.1.9':
resolution: {integrity: sha512-E1B35FwzXXTs9FHNK6bDszs7mtydNi5MIfUWpceJ8Xbfb1gBMscAnwLbEu+B44ed6W3XjL9/ehLPHR1fkf1KLQ==}
'@vitest/spy@3.2.4':
resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==}
@ -11256,6 +11328,9 @@ packages:
peerDependencies:
vitest: 4.0.14
'@vitest/utils@2.1.9':
resolution: {integrity: sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ==}
'@vitest/utils@3.2.4':
resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==}
@ -12602,6 +12677,10 @@ packages:
resolution: {integrity: sha512-0LrrStPOdJj+SPCCrGhzryycLjwcgUSHBtxNA8aIDxf0GLsRh1cKYhB00Gd1lDOS4yGH69+SNn13+TWbVHETFQ==}
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
cssstyle@4.6.0:
resolution: {integrity: sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==}
engines: {node: '>=18'}
cssstyle@5.3.3:
resolution: {integrity: sha512-OytmFH+13/QXONJcC75QNdMtKpceNk3u8ThBjyyYjkEcy/ekBwR1mMAuNvi3gdBPW3N5TlCzQ0WZw8H0lN/bDw==}
engines: {node: '>=20'}
@ -12751,6 +12830,10 @@ packages:
resolution: {integrity: sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==}
engines: {node: '>= 12'}
data-urls@5.0.0:
resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==}
engines: {node: '>=18'}
data-urls@6.0.0:
resolution: {integrity: sha512-BnBS08aLUM+DKamupXs3w2tJJoqU+AkaE/+6vQxi/G/DPmIZFJJp9Dkb1kM03AZx8ADehDUZgsNxju3mPXZYIA==}
engines: {node: '>=20'}
@ -15904,6 +15987,15 @@ packages:
peerDependencies:
'@babel/preset-env': ^7.1.6
jsdom@25.0.1:
resolution: {integrity: sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==}
engines: {node: '>=18'}
peerDependencies:
canvas: ^2.11.2
peerDependenciesMeta:
canvas:
optional: true
jsdom@27.2.0:
resolution: {integrity: sha512-454TI39PeRDW1LgpyLPyURtB4Zx1tklSr6+OFOipsxGUH1WMTvk6C65JQdrj455+DP2uJ1+veBEHTGFKWVLFoA==}
engines: {node: ^20.19.0 || ^22.12.0 || >=24.0.0}
@ -17262,6 +17354,9 @@ packages:
nullthrows@1.1.1:
resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==}
nwsapi@2.2.23:
resolution: {integrity: sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==}
oauth-sign@0.9.0:
resolution: {integrity: sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==}
@ -18739,6 +18834,12 @@ packages:
rrule@2.8.1:
resolution: {integrity: sha512-hM3dHSBMeaJ0Ktp7W38BJZ7O1zOgaFEsn41PDk+yHoEtfLV+PoJt9E9xAlZiWgf/iqEqionN0ebHFZIDAp+iGw==}
rrweb-cssom@0.7.1:
resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==}
rrweb-cssom@0.8.0:
resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==}
rtl-detect@1.1.2:
resolution: {integrity: sha512-PGMBq03+TTG/p/cRB7HCLKJ1MgDIi07+QU1faSjiYRfmY5UsAttV9Hs08jDAHVwcOwmVLcSJkpwyfXszVjWfIQ==}
@ -19499,6 +19600,10 @@ packages:
resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==}
engines: {node: ^18.0.0 || >=20.0.0}
tinyrainbow@1.2.0:
resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==}
engines: {node: '>=14.0.0'}
tinyrainbow@2.0.0:
resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==}
engines: {node: '>=14.0.0'}
@ -19507,13 +19612,24 @@ packages:
resolution: {integrity: sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==}
engines: {node: '>=14.0.0'}
tinyspy@3.0.2:
resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==}
engines: {node: '>=14.0.0'}
tinyspy@4.0.4:
resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==}
engines: {node: '>=14.0.0'}
tldts-core@6.1.86:
resolution: {integrity: sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==}
tldts-core@7.0.19:
resolution: {integrity: sha512-lJX2dEWx0SGH4O6p+7FPwYmJ/bu1JbcGJ8RLaG9b7liIgZ85itUVEPbMtWRVrde/0fnDPEPHW10ZsKW3kVsE9A==}
tldts@6.1.86:
resolution: {integrity: sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==}
hasBin: true
tldts@7.0.19:
resolution: {integrity: sha512-8PWx8tvC4jDB39BQw1m4x8y5MH1BcQ5xHeL2n7UVFulMPH/3Q0uiamahFJ3lXA0zO2SUyRXuVVbWSDmstlt9YA==}
hasBin: true
@ -19556,6 +19672,10 @@ packages:
resolution: {integrity: sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==}
engines: {node: '>=0.8'}
tough-cookie@5.1.2:
resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==}
engines: {node: '>=16'}
tough-cookie@6.0.0:
resolution: {integrity: sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w==}
engines: {node: '>=16'}
@ -19563,6 +19683,10 @@ packages:
tr46@0.0.3:
resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==}
tr46@5.1.1:
resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==}
engines: {node: '>=18'}
tr46@6.0.0:
resolution: {integrity: sha512-bLVMLPtstlZ4iMQHpFHTR7GAGj2jxi8Dg0s2h2MafAE4uSWF98FC/3MomU51iQAMf8/qDUbKWf5GxuvvVcXEhw==}
engines: {node: '>=20'}
@ -20178,6 +20302,11 @@ packages:
vfile@6.0.3:
resolution: {integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==}
vite-node@2.1.9:
resolution: {integrity: sha512-AM9aQ/IPrW/6ENLQg3AGY4K1N2TGZdR5e4gu/MmmR2xR3Ll1+dib+nook92g4TV3PXVyeyxdWwtaCAiUL0hMxA==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
vite-node@3.2.4:
resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
@ -20302,6 +20431,31 @@ packages:
vite:
optional: true
vitest@2.1.9:
resolution: {integrity: sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==}
engines: {node: ^18.0.0 || >=20.0.0}
hasBin: true
peerDependencies:
'@edge-runtime/vm': '*'
'@types/node': ^18.0.0 || >=20.0.0
'@vitest/browser': 2.1.9
'@vitest/ui': 2.1.9
happy-dom: '*'
jsdom: '*'
peerDependenciesMeta:
'@edge-runtime/vm':
optional: true
'@types/node':
optional: true
'@vitest/browser':
optional: true
'@vitest/ui':
optional: true
happy-dom:
optional: true
jsdom:
optional: true
vitest@3.2.4:
resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==}
engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
@ -20498,6 +20652,10 @@ packages:
resolution: {integrity: sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==}
engines: {node: '>=8'}
webidl-conversions@7.0.0:
resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==}
engines: {node: '>=12'}
webidl-conversions@8.0.0:
resolution: {integrity: sha512-n4W4YFyz5JzOfQeA8oN7dUYpR+MBP3PIUsn2jLjWXwK5ASUzt0Jc/A5sAUZoCYFJRGF0FBKJ+1JjN43rNdsQzA==}
engines: {node: '>=20'}
@ -20546,6 +20704,10 @@ packages:
resolution: {integrity: sha512-HoKuzZrUlgpz35YO27XgD28uh/WJH4B0+3ttFqRo//lmq+9T/mIOJ6kqmINI9HpUpz1imRC/nR/lxKpJiv0uig==}
engines: {node: '>=10'}
whatwg-url@14.2.0:
resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==}
engines: {node: '>=18'}
whatwg-url@15.1.0:
resolution: {integrity: sha512-2ytDk0kiEj/yu90JOAp44PVPUkO9+jVhyf+SybKlRHSDlvOOZhdPIrr7xTH64l4WixO2cP+wQIcgujkGBPPz6g==}
engines: {node: '>=20'}
@ -21008,6 +21170,14 @@ snapshots:
'@antfu/utils@8.1.1': {}
'@asamuzakjp/css-color@3.2.0':
dependencies:
'@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)
'@csstools/css-color-parser': 3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)
'@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4)
'@csstools/css-tokenizer': 3.0.4
lru-cache: 10.4.3
'@asamuzakjp/css-color@4.1.0':
dependencies:
'@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)
@ -23114,14 +23284,12 @@ snapshots:
dependencies:
'@jridgewell/trace-mapping': 0.3.9
'@csstools/color-helpers@5.1.0':
optional: true
'@csstools/color-helpers@5.1.0': {}
'@csstools/css-calc@2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)':
dependencies:
'@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4)
'@csstools/css-tokenizer': 3.0.4
optional: true
'@csstools/css-color-parser@3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)':
dependencies:
@ -23129,18 +23297,15 @@ snapshots:
'@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)
'@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4)
'@csstools/css-tokenizer': 3.0.4
optional: true
'@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4)':
dependencies:
'@csstools/css-tokenizer': 3.0.4
optional: true
'@csstools/css-syntax-patches-for-csstree@1.0.17':
optional: true
'@csstools/css-tokenizer@3.0.4':
optional: true
'@csstools/css-tokenizer@3.0.4': {}
'@dabh/diagnostics@2.0.8':
dependencies:
@ -29406,7 +29571,6 @@ snapshots:
lz-string: 1.5.0
picocolors: 1.1.1
pretty-format: 27.5.1
optional: true
'@testing-library/react-native@13.3.3(jest@29.7.0(@types/node@22.19.1)(ts-node@10.9.2(@types/node@22.19.1)(typescript@5.9.3)))(react-native@0.81.5(@babel/core@7.28.5)(@types/react@19.2.7)(react@19.1.0))(react-test-renderer@19.1.0(react@19.1.0))(react@19.1.0)':
dependencies:
@ -29473,6 +29637,19 @@ snapshots:
jest: 30.2.0(esbuild-register@3.6.0(esbuild@0.27.0))
optional: true
'@testing-library/svelte-core@1.0.0(svelte@5.44.0)':
dependencies:
svelte: 5.44.0
'@testing-library/svelte@5.3.1(svelte@5.44.0)(vite@6.4.1(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1))(vitest@2.1.9(@types/node@20.19.25)(jsdom@25.0.1)(lightningcss@1.30.2)(terser@5.44.1))':
dependencies:
'@testing-library/dom': 10.4.1
'@testing-library/svelte-core': 1.0.0(svelte@5.44.0)
svelte: 5.44.0
optionalDependencies:
vite: 6.4.1(@types/node@20.19.25)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1)
vitest: 2.1.9(@types/node@20.19.25)(jsdom@25.0.1)(lightningcss@1.30.2)(terser@5.44.1)
'@testing-library/user-event@14.6.1(@testing-library/dom@10.4.1)':
dependencies:
'@testing-library/dom': 10.4.1
@ -29513,8 +29690,7 @@ snapshots:
tslib: 2.8.1
optional: true
'@types/aria-query@5.0.4':
optional: true
'@types/aria-query@5.0.4': {}
'@types/babel__core@7.20.5':
dependencies:
@ -30753,6 +30929,13 @@ snapshots:
transitivePeerDependencies:
- supports-color
'@vitest/expect@2.1.9':
dependencies:
'@vitest/spy': 2.1.9
'@vitest/utils': 2.1.9
chai: 5.3.3
tinyrainbow: 1.2.0
'@vitest/expect@3.2.4':
dependencies:
'@types/chai': 5.2.3
@ -30770,6 +30953,22 @@ snapshots:
chai: 6.2.1
tinyrainbow: 3.0.3
'@vitest/mocker@2.1.9(vite@5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1))':
dependencies:
'@vitest/spy': 2.1.9
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
vite: 5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1)
'@vitest/mocker@2.1.9(vite@5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1))':
dependencies:
'@vitest/spy': 2.1.9
estree-walker: 3.0.3
magic-string: 0.30.21
optionalDependencies:
vite: 5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1)
'@vitest/mocker@3.2.4(vite@7.2.4(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1))':
dependencies:
'@vitest/spy': 3.2.4
@ -30786,6 +30985,10 @@ snapshots:
optionalDependencies:
vite: 7.2.4(@types/node@22.19.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1)
'@vitest/pretty-format@2.1.9':
dependencies:
tinyrainbow: 1.2.0
'@vitest/pretty-format@3.2.4':
dependencies:
tinyrainbow: 2.0.0
@ -30794,6 +30997,11 @@ snapshots:
dependencies:
tinyrainbow: 3.0.3
'@vitest/runner@2.1.9':
dependencies:
'@vitest/utils': 2.1.9
pathe: 1.1.2
'@vitest/runner@3.2.4':
dependencies:
'@vitest/utils': 3.2.4
@ -30805,6 +31013,12 @@ snapshots:
'@vitest/utils': 4.0.14
pathe: 2.0.3
'@vitest/snapshot@2.1.9':
dependencies:
'@vitest/pretty-format': 2.1.9
magic-string: 0.30.21
pathe: 1.1.2
'@vitest/snapshot@3.2.4':
dependencies:
'@vitest/pretty-format': 3.2.4
@ -30817,6 +31031,10 @@ snapshots:
magic-string: 0.30.21
pathe: 2.0.3
'@vitest/spy@2.1.9':
dependencies:
tinyspy: 3.0.2
'@vitest/spy@3.2.4':
dependencies:
tinyspy: 4.0.4
@ -30846,6 +31064,12 @@ snapshots:
tinyrainbow: 3.0.3
vitest: 4.0.14(@opentelemetry/api@1.9.0)(@types/node@22.19.1)(@vitest/ui@4.0.14)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1)
'@vitest/utils@2.1.9':
dependencies:
'@vitest/pretty-format': 2.1.9
loupe: 3.2.1
tinyrainbow: 1.2.0
'@vitest/utils@3.2.4':
dependencies:
'@vitest/pretty-format': 3.2.4
@ -31221,7 +31445,6 @@ snapshots:
aria-query@5.3.0:
dependencies:
dequal: 2.0.3
optional: true
aria-query@5.3.2: {}
@ -32829,6 +33052,11 @@ snapshots:
dependencies:
css-tree: 2.2.1
cssstyle@4.6.0:
dependencies:
'@asamuzakjp/css-color': 3.2.0
rrweb-cssom: 0.8.0
cssstyle@5.3.3:
dependencies:
'@asamuzakjp/css-color': 4.1.0
@ -33003,6 +33231,11 @@ snapshots:
data-uri-to-buffer@4.0.1: {}
data-urls@5.0.0:
dependencies:
whatwg-mimetype: 4.0.0
whatwg-url: 14.2.0
data-urls@6.0.0:
dependencies:
whatwg-mimetype: 4.0.0
@ -33174,8 +33407,7 @@ snapshots:
dependencies:
esutils: 2.0.3
dom-accessibility-api@0.5.16:
optional: true
dom-accessibility-api@0.5.16: {}
dom-serializer@2.0.0:
dependencies:
@ -37226,7 +37458,6 @@ snapshots:
html-encoding-sniffer@4.0.0:
dependencies:
whatwg-encoding: 3.1.1
optional: true
html-escaper@2.0.2: {}
@ -37635,8 +37866,7 @@ snapshots:
is-plain-object@5.0.0: {}
is-potential-custom-element-name@1.0.1:
optional: true
is-potential-custom-element-name@1.0.1: {}
is-promise@2.2.2: {}
@ -38782,6 +39012,34 @@ snapshots:
transitivePeerDependencies:
- supports-color
jsdom@25.0.1:
dependencies:
cssstyle: 4.6.0
data-urls: 5.0.0
decimal.js: 10.6.0
form-data: 4.0.5
html-encoding-sniffer: 4.0.0
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.6
is-potential-custom-element-name: 1.0.1
nwsapi: 2.2.23
parse5: 7.3.0
rrweb-cssom: 0.7.1
saxes: 6.0.0
symbol-tree: 3.2.4
tough-cookie: 5.1.2
w3c-xmlserializer: 5.0.0
webidl-conversions: 7.0.0
whatwg-encoding: 3.1.1
whatwg-mimetype: 4.0.0
whatwg-url: 14.2.0
ws: 8.18.3
xml-name-validator: 5.0.0
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
jsdom@27.2.0:
dependencies:
'@acemir/cssom': 0.9.24
@ -39223,8 +39481,7 @@ snapshots:
luxon@3.5.0: {}
lz-string@1.5.0:
optional: true
lz-string@1.5.0: {}
magic-string@0.30.17:
dependencies:
@ -40835,6 +41092,8 @@ snapshots:
nullthrows@1.1.1: {}
nwsapi@2.2.23: {}
oauth-sign@0.9.0: {}
ob1@0.81.5:
@ -41400,7 +41659,6 @@ snapshots:
ansi-regex: 5.0.1
ansi-styles: 5.2.0
react-is: 17.0.2
optional: true
pretty-format@29.7.0:
dependencies:
@ -41622,8 +41880,7 @@ snapshots:
react-is@16.13.1: {}
react-is@17.0.2:
optional: true
react-is@17.0.2: {}
react-is@18.3.1: {}
@ -43244,6 +43501,10 @@ snapshots:
dependencies:
tslib: 2.8.1
rrweb-cssom@0.7.1: {}
rrweb-cssom@0.8.0: {}
rtl-detect@1.1.2: {}
run-async@2.4.1: {}
@ -43321,7 +43582,6 @@ snapshots:
saxes@6.0.0:
dependencies:
xmlchars: 2.2.0
optional: true
scheduler@0.23.2:
dependencies:
@ -44066,8 +44326,7 @@ snapshots:
symbol-observable@4.0.0: {}
symbol-tree@3.2.4:
optional: true
symbol-tree@3.2.4: {}
synckit@0.11.11:
dependencies:
@ -44264,15 +44523,25 @@ snapshots:
tinypool@1.1.1: {}
tinyrainbow@1.2.0: {}
tinyrainbow@2.0.0: {}
tinyrainbow@3.0.3: {}
tinyspy@3.0.2: {}
tinyspy@4.0.4: {}
tldts-core@6.1.86: {}
tldts-core@7.0.19:
optional: true
tldts@6.1.86:
dependencies:
tldts-core: 6.1.86
tldts@7.0.19:
dependencies:
tldts-core: 7.0.19
@ -44314,6 +44583,10 @@ snapshots:
psl: 1.15.0
punycode: 2.3.1
tough-cookie@5.1.2:
dependencies:
tldts: 6.1.86
tough-cookie@6.0.0:
dependencies:
tldts: 7.0.19
@ -44321,6 +44594,10 @@ snapshots:
tr46@0.0.3: {}
tr46@5.1.1:
dependencies:
punycode: 2.3.1
tr46@6.0.0:
dependencies:
punycode: 2.3.1
@ -45034,6 +45311,42 @@ snapshots:
'@types/unist': 3.0.3
vfile-message: 4.0.3
vite-node@2.1.9(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
cac: 6.7.14
debug: 4.4.3
es-module-lexer: 1.7.0
pathe: 1.1.2
vite: 5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1)
transitivePeerDependencies:
- '@types/node'
- less
- lightningcss
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
vite-node@2.1.9(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
cac: 6.7.14
debug: 4.4.3
es-module-lexer: 1.7.0
pathe: 1.1.2
vite: 5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1)
transitivePeerDependencies:
- '@types/node'
- less
- lightningcss
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
vite-node@3.2.4(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1):
dependencies:
cac: 6.7.14
@ -45055,6 +45368,17 @@ snapshots:
- tsx
- yaml
vite@5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
esbuild: 0.21.5
postcss: 8.5.6
rollup: 4.53.3
optionalDependencies:
'@types/node': 20.19.25
fsevents: 2.3.3
lightningcss: 1.30.2
terser: 5.44.1
vite@5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
esbuild: 0.21.5
@ -45214,6 +45538,78 @@ snapshots:
optionalDependencies:
vite: 7.2.4(@types/node@24.10.1)(jiti@2.6.1)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1)
vitest@2.1.9(@types/node@20.19.25)(jsdom@25.0.1)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
'@vitest/expect': 2.1.9
'@vitest/mocker': 2.1.9(vite@5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1))
'@vitest/pretty-format': 2.1.9
'@vitest/runner': 2.1.9
'@vitest/snapshot': 2.1.9
'@vitest/spy': 2.1.9
'@vitest/utils': 2.1.9
chai: 5.3.3
debug: 4.4.3
expect-type: 1.2.2
magic-string: 0.30.21
pathe: 1.1.2
std-env: 3.10.0
tinybench: 2.9.0
tinyexec: 0.3.2
tinypool: 1.1.1
tinyrainbow: 1.2.0
vite: 5.4.21(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1)
vite-node: 2.1.9(@types/node@20.19.25)(lightningcss@1.30.2)(terser@5.44.1)
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 20.19.25
jsdom: 25.0.1
transitivePeerDependencies:
- less
- lightningcss
- msw
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
vitest@2.1.9(@types/node@24.10.1)(jsdom@27.2.0)(lightningcss@1.30.2)(terser@5.44.1):
dependencies:
'@vitest/expect': 2.1.9
'@vitest/mocker': 2.1.9(vite@5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1))
'@vitest/pretty-format': 2.1.9
'@vitest/runner': 2.1.9
'@vitest/snapshot': 2.1.9
'@vitest/spy': 2.1.9
'@vitest/utils': 2.1.9
chai: 5.3.3
debug: 4.4.3
expect-type: 1.2.2
magic-string: 0.30.21
pathe: 1.1.2
std-env: 3.10.0
tinybench: 2.9.0
tinyexec: 0.3.2
tinypool: 1.1.1
tinyrainbow: 1.2.0
vite: 5.4.21(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1)
vite-node: 2.1.9(@types/node@24.10.1)(lightningcss@1.30.2)(terser@5.44.1)
why-is-node-running: 2.3.0
optionalDependencies:
'@types/node': 24.10.1
jsdom: 27.2.0
transitivePeerDependencies:
- less
- lightningcss
- msw
- sass
- sass-embedded
- stylus
- sugarss
- supports-color
- terser
vitest@3.2.4(@types/debug@4.1.12)(@types/node@24.10.1)(@vitest/browser@3.2.4)(@vitest/ui@3.2.4)(jiti@2.6.1)(jsdom@27.2.0)(lightningcss@1.30.2)(terser@5.44.1)(tsx@4.20.6)(yaml@2.8.1):
dependencies:
'@types/chai': 5.2.3
@ -45403,7 +45799,6 @@ snapshots:
w3c-xmlserializer@5.0.0:
dependencies:
xml-name-validator: 5.0.0
optional: true
walker@1.0.8:
dependencies:
@ -45430,6 +45825,8 @@ snapshots:
webidl-conversions@5.0.0: {}
webidl-conversions@7.0.0: {}
webidl-conversions@8.0.0:
optional: true
@ -45605,6 +46002,11 @@ snapshots:
punycode: 2.3.1
webidl-conversions: 5.0.0
whatwg-url@14.2.0:
dependencies:
tr46: 5.1.1
webidl-conversions: 7.0.0
whatwg-url@15.1.0:
dependencies:
tr46: 6.0.0
@ -45804,8 +46206,7 @@ snapshots:
dependencies:
sax: 1.4.3
xml-name-validator@5.0.0:
optional: true
xml-name-validator@5.0.0: {}
xml2js@0.6.0:
dependencies:
@ -45818,8 +46219,7 @@ snapshots:
xmlbuilder@15.1.1: {}
xmlchars@2.2.0:
optional: true
xmlchars@2.2.0: {}
xtend@4.0.2: {}