Remove obsolete scripts and files, update site builder configurations

- Deleted the `import_plans.py`, `run_tests.py`, and `test_run.py` scripts as they are no longer needed.
- Updated the initial migration dependency in `0001_initial.py` to reflect recent changes in the `igny8_core_auth` app.
- Enhanced the implementation plan documentation to include new phases and updates on the site builder project.
- Updated the `vite.config.ts` and `package.json` to integrate testing configurations and dependencies for the site builder.
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-17 17:48:15 +00:00
parent 5a36686844
commit 4b9e1a49a9
23 changed files with 4305 additions and 342 deletions

View File

@@ -0,0 +1,92 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { useBuilderStore } from '../builderStore';
import type { BuilderFormData } from '../../types/siteBuilder';
describe('builderStore', () => {
beforeEach(() => {
useBuilderStore.getState().reset();
});
it('initializes with default form values', () => {
const state = useBuilderStore.getState();
expect(state.form.siteName).toBe('');
expect(state.form.hostingType).toBe('igny8_sites');
expect(state.form.objectives).toEqual(['Launch a conversion-focused marketing site']);
expect(state.currentStep).toBe(0);
});
it('updates form fields', () => {
const { setField } = useBuilderStore.getState();
setField('siteName', 'Test Site');
setField('businessType', 'SaaS');
const state = useBuilderStore.getState();
expect(state.form.siteName).toBe('Test Site');
expect(state.form.businessType).toBe('SaaS');
});
it('navigates steps correctly', () => {
const { nextStep, previousStep, setStep } = useBuilderStore.getState();
expect(useBuilderStore.getState().currentStep).toBe(0);
nextStep();
expect(useBuilderStore.getState().currentStep).toBe(1);
nextStep();
expect(useBuilderStore.getState().currentStep).toBe(2);
previousStep();
expect(useBuilderStore.getState().currentStep).toBe(1);
setStep(3);
expect(useBuilderStore.getState().currentStep).toBe(3);
// Should not go beyond max step
nextStep();
expect(useBuilderStore.getState().currentStep).toBe(3);
});
it('manages objectives list', () => {
const { addObjective, removeObjective } = useBuilderStore.getState();
addObjective('Increase brand awareness');
expect(useBuilderStore.getState().form.objectives).toContain('Increase brand awareness');
addObjective('Drive conversions');
expect(useBuilderStore.getState().form.objectives.length).toBe(3); // 1 default + 2 added
removeObjective(0);
expect(useBuilderStore.getState().form.objectives.length).toBe(2);
expect(useBuilderStore.getState().form.objectives).not.toContain('Launch a conversion-focused marketing site');
});
it('updates style preferences', () => {
const { updateStyle } = useBuilderStore.getState();
updateStyle({ palette: 'Dark mode palette' });
expect(useBuilderStore.getState().form.style.palette).toBe('Dark mode palette');
updateStyle({ personality: 'Professional, trustworthy' });
expect(useBuilderStore.getState().form.style.personality).toBe('Professional, trustworthy');
expect(useBuilderStore.getState().form.style.palette).toBe('Dark mode palette'); // Previous value preserved
});
it('resets to initial state', () => {
const { setField, nextStep, addObjective, reset } = useBuilderStore.getState();
setField('siteName', 'Modified');
nextStep();
addObjective('Test objective');
reset();
const state = useBuilderStore.getState();
expect(state.form.siteName).toBe('');
expect(state.currentStep).toBe(0);
expect(state.form.objectives).toEqual(['Launch a conversion-focused marketing site']);
expect(state.isSubmitting).toBe(false);
expect(state.error).toBeUndefined();
});
});

View File

@@ -0,0 +1,95 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { useSiteDefinitionStore } from '../siteDefinitionStore';
import type { SiteStructure, PageBlueprint } from '../../types/siteBuilder';
describe('siteDefinitionStore', () => {
beforeEach(() => {
useSiteDefinitionStore.setState({
structure: undefined,
pages: [],
selectedSlug: undefined,
});
});
it('initializes with empty state', () => {
const state = useSiteDefinitionStore.getState();
expect(state.pages).toEqual([]);
expect(state.structure).toBeUndefined();
expect(state.selectedSlug).toBeUndefined();
});
it('sets structure and auto-selects first page', () => {
const mockStructure: SiteStructure = {
site: { name: 'Test Site' },
pages: [
{ slug: 'home', title: 'Home', type: 'home', blocks: [] },
{ slug: 'about', title: 'About', type: 'about', blocks: [] },
],
};
useSiteDefinitionStore.getState().setStructure(mockStructure);
const state = useSiteDefinitionStore.getState();
expect(state.structure).toEqual(mockStructure);
expect(state.selectedSlug).toBe('home');
});
it('sets pages and auto-selects first page if none selected', () => {
const mockPages: PageBlueprint[] = [
{
id: 1,
site_blueprint: 1,
slug: 'services',
title: 'Services',
type: 'services',
status: 'ready',
order: 0,
blocks_json: [],
},
];
useSiteDefinitionStore.getState().setPages(mockPages);
const state = useSiteDefinitionStore.getState();
expect(state.pages).toEqual(mockPages);
expect(state.selectedSlug).toBe('services');
});
it('preserves selected slug when setting pages if already selected', () => {
useSiteDefinitionStore.setState({ selectedSlug: 'about' });
const mockPages: PageBlueprint[] = [
{
id: 1,
site_blueprint: 1,
slug: 'home',
title: 'Home',
type: 'home',
status: 'ready',
order: 0,
blocks_json: [],
},
{
id: 2,
site_blueprint: 1,
slug: 'about',
title: 'About',
type: 'about',
status: 'ready',
order: 1,
blocks_json: [],
},
];
useSiteDefinitionStore.getState().setPages(mockPages);
const state = useSiteDefinitionStore.getState();
expect(state.selectedSlug).toBe('about');
});
it('selects page by slug', () => {
useSiteDefinitionStore.getState().selectPage('contact');
expect(useSiteDefinitionStore.getState().selectedSlug).toBe('contact');
});
});