feat(content): guid in resolve/componenti + GET /api/admin/content/[tag]

This commit is contained in:
2026-07-05 21:56:53 +02:00
parent c3267c9be2
commit 5ce10da9bd
6 changed files with 51 additions and 15 deletions
+13
View File
@@ -35,3 +35,16 @@ describe('applyContentUpdate', () => {
expect(applyContentUpdate(db, imgTag, { value: 'x' }, 'a')).toMatchObject({ ok: false, status: 400 });
});
});
describe('GET /api/admin/content/[tag]', () => {
it('GET /api/admin/content/[tag] ritorna tag, guid, type, value, styleOptions', async () => {
const { GET } = await import('../src/pages/api/admin/content/[tag]');
const res = await GET({ params: { tag: 'home.hero.cta' } } as any);
expect(res.status).toBe(200);
const body = await res.json();
expect(body.tag).toBe('home.hero.cta');
expect(typeof body.guid).toBe('string');
expect(body.type).toBeDefined();
expect(Array.isArray(body.styleOptions)).toBe(true);
});
});