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
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 50s
This commit is contained in:
30
tests/fileGenerator.test.ts
Normal file
30
tests/fileGenerator.test.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user