From e9383991524e6f65121a11858059fee0622cc62e Mon Sep 17 00:00:00 2001 From: mmabdalla <101379618+mmabdalla@users.noreply.github.com> Date: Sun, 28 Dec 2025 15:05:42 +0200 Subject: [PATCH] Reset version to 0.0.0.001 and add test framework setup for Phase 1 TDD --- backend/api/pages.test.ts | 69 ++++++++++++++++++++ frontend/editor/components/DragDrop.test.tsx | 35 ++++++++++ frontend/editor/components/Editor.test.tsx | 36 ++++++++++ jest.config.js | 34 ++++++++++ package.json | 7 ++ version.txt | 2 +- 6 files changed, 182 insertions(+), 1 deletion(-) create mode 100644 backend/api/pages.test.ts create mode 100644 frontend/editor/components/DragDrop.test.tsx create mode 100644 frontend/editor/components/Editor.test.tsx create mode 100644 jest.config.js diff --git a/backend/api/pages.test.ts b/backend/api/pages.test.ts new file mode 100644 index 0000000..732b97f --- /dev/null +++ b/backend/api/pages.test.ts @@ -0,0 +1,69 @@ +// WB-006: Page Config Storage - Tests First (TDD) +import { describe, it, expect, beforeEach } from '@jest/globals'; + +describe('Page Config Storage API', () => { + beforeEach(() => { + // Setup test database + }); + + describe('createPage', () => { + it('should create a new page with valid config', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should reject invalid page config', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should enforce unique app_name and route_path combination', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + }); + + describe('getPage', () => { + it('should retrieve page by id', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should return 404 for non-existent page', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + }); + + describe('updatePage', () => { + it('should update existing page config', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should increment version on update', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + }); + + describe('deletePage', () => { + it('should delete page by id', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + }); + + describe('listPages', () => { + it('should list all pages', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should filter pages by app_name', async () => { + // TODO: Implement test + expect(true).toBe(true); + }); + }); +}); + diff --git a/frontend/editor/components/DragDrop.test.tsx b/frontend/editor/components/DragDrop.test.tsx new file mode 100644 index 0000000..addaa22 --- /dev/null +++ b/frontend/editor/components/DragDrop.test.tsx @@ -0,0 +1,35 @@ +// WB-003: Drag-and-Drop System - Tests First (TDD) +import { describe, it, expect } from '@jest/globals'; + +describe('Drag and Drop System', () => { + it('should allow dragging component from palette', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should allow dropping component on canvas', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should prevent dropping on invalid zones', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should show visual feedback during drag', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should handle drag start event', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should handle drag end event', () => { + // TODO: Implement test + expect(true).toBe(true); + }); +}); + diff --git a/frontend/editor/components/Editor.test.tsx b/frontend/editor/components/Editor.test.tsx new file mode 100644 index 0000000..2881a81 --- /dev/null +++ b/frontend/editor/components/Editor.test.tsx @@ -0,0 +1,36 @@ +// WB-002: Basic Editor UI Layout - Tests First (TDD) +import { describe, it, expect } from '@jest/globals'; +import { render, screen } from '@testing-library/react'; + +describe('Editor Component', () => { + it('should render main editor container', () => { + // TODO: Implement test after component is created + expect(true).toBe(true); + }); + + it('should render top toolbar with save, preview, exit buttons', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should render left sidebar for component palette', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should render right sidebar for property panel', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should render center canvas area', () => { + // TODO: Implement test + expect(true).toBe(true); + }); + + it('should display loading state when loading', () => { + // TODO: Implement test + expect(true).toBe(true); + }); +}); + diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..b83662a --- /dev/null +++ b/jest.config.js @@ -0,0 +1,34 @@ +export default { + testEnvironment: 'jsdom', + preset: 'ts-jest/presets/default-esm', + extensionsToTreatAsEsm: ['.ts', '.tsx'], + moduleNameMapper: { + '^@/(.*)$': '/frontend/$1', + '^@editor/(.*)$': '/frontend/editor/$1', + '^@renderer/(.*)$': '/frontend/renderer/$1', + '^@components/(.*)$': '/frontend/components/$1', + '^@backend/(.*)$': '/backend/$1', + '^@api/(.*)$': '/backend/api/$1', + '\\.(css|less|scss|sass)$': 'identity-obj-proxy', + }, + transform: { + '^.+\\.(ts|tsx)$': ['ts-jest', { useESM: true }], + }, + testMatch: ['**/__tests__/**/*.test.{ts,tsx}', '**/*.test.{ts,tsx}'], + collectCoverageFrom: [ + 'frontend/**/*.{ts,tsx}', + 'backend/**/*.ts', + '!**/*.d.ts', + '!**/node_modules/**', + '!**/dist/**', + ], + coverageThreshold: { + global: { + branches: 80, + functions: 80, + lines: 80, + statements: 80, + }, + }, +}; + diff --git a/package.json b/package.json index 0c0fb52..3c9ced8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,11 @@ "react-dom": "^18.2.0" }, "devDependencies": { + "@testing-library/jest-dom": "^6.1.5", + "@testing-library/react": "^14.1.2", + "@testing-library/user-event": "^14.5.1", "@types/express": "^4.17.21", + "@types/jest": "^29.5.11", "@types/node": "^20.10.0", "@types/react": "^18.2.45", "@types/react-dom": "^18.2.18", @@ -42,8 +46,11 @@ "eslint-config-prettier": "^9.1.0", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", + "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "prettier": "^3.1.1", + "ts-jest": "^29.1.1", "typescript": "^5.3.3", "vite": "^5.0.8" } diff --git a/version.txt b/version.txt index 2d7108b..7c403c9 100644 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ -BP_WB Version 0.1.0.001 +BP_WB Version 0.0.0.001 Date: December 21, 2025 === Latest Changes ===