feat: implement DB-driven architecture with SQLite persistence and file-generator compilation service
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 50s

This commit is contained in:
Daniel S
2026-08-10 00:09:10 +02:00
parent 950497311c
commit db2f607e5a
12 changed files with 375 additions and 306 deletions

View File

@@ -0,0 +1,30 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { getDb } from '../src/db/index';
import { generateDraftConfig, publishLiveConfig } from '../src/services/file-generator';
import fs from 'node:fs/promises';
import path from 'node:path';
describe('DB-Driven File Generation Service Test', () => {
it('soll Entwurf aus DB lesen und site.config.draft.json generieren', async () => {
const draftConfig = await generateDraftConfig();
expect(draftConfig).toBeDefined();
expect(draftConfig.pages).toBeDefined();
expect(Array.isArray(draftConfig.pages)).toBe(true);
const DATA_DIR = process.env.DATA_DIR || path.join(process.cwd(), 'app', 'data');
const draftPath = path.join(DATA_DIR, 'site.config.draft.json');
const exists = await fs.access(draftPath).then(() => true).catch(() => false);
expect(exists).toBe(true);
});
it('soll Live-Config aus DB freigeben und site.config.json atomar erstellen', async () => {
const liveConfig = await publishLiveConfig();
expect(liveConfig).toBeDefined();
expect(liveConfig.pages).toBeDefined();
const DATA_DIR = process.env.DATA_DIR || path.join(process.cwd(), 'app', 'data');
const livePath = path.join(DATA_DIR, 'site.config.json');
const exists = await fs.access(livePath).then(() => true).catch(() => false);
expect(exists).toBe(true);
});
});