feat(admin): add global site settings API, tests and dashboard UI
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 35s

This commit is contained in:
Daniel S
2026-08-09 21:26:15 +02:00
parent a35efb2726
commit 03ceb3de7f
4 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { describe, it, expect, beforeEach } from 'vitest';
import fs from 'node:fs/promises';
import path from 'node:path';
const DATA_DIR = path.join(process.cwd(), 'app', 'test_data_site_settings');
const configPath = path.join(DATA_DIR, 'site.config.json');
describe('Global Site Settings API Test', () => {
beforeEach(async () => {
await fs.mkdir(DATA_DIR, { recursive: true });
const dummyConfig = {
site_info: { title: 'Alte Firma', phone: '0123456' },
navigation: [{ label: 'Home', page_id: 'page_1' }]
};
await fs.writeFile(configPath, JSON.stringify(dummyConfig, null, 2), 'utf-8');
});
it('soll globale Stammdaten in site.config.json aktualisieren', async () => {
const raw = await fs.readFile(configPath, 'utf-8');
const config = JSON.parse(raw);
config.site_info.title = 'N&D IT Solutions GmbH';
config.site_info.phone = '+49 7473 123456';
await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');
const updatedRaw = await fs.readFile(configPath, 'utf-8');
const updatedConfig = JSON.parse(updatedRaw);
expect(updatedConfig.site_info.title).toBe('N&D IT Solutions GmbH');
expect(updatedConfig.site_info.phone).toBe('+49 7473 123456');
});
});