Reset version to 0.0.0.001 and add test framework setup for Phase 1 TDD

This commit is contained in:
mmabdalla 2025-12-28 15:05:42 +02:00
parent c14f186263
commit e938399152
6 changed files with 182 additions and 1 deletions

69
backend/api/pages.test.ts Normal file
View file

@ -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);
});
});
});

View file

@ -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);
});
});

View file

@ -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);
});
});

34
jest.config.js Normal file
View file

@ -0,0 +1,34 @@
export default {
testEnvironment: 'jsdom',
preset: 'ts-jest/presets/default-esm',
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/frontend/$1',
'^@editor/(.*)$': '<rootDir>/frontend/editor/$1',
'^@renderer/(.*)$': '<rootDir>/frontend/renderer/$1',
'^@components/(.*)$': '<rootDir>/frontend/components/$1',
'^@backend/(.*)$': '<rootDir>/backend/$1',
'^@api/(.*)$': '<rootDir>/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,
},
},
};

View file

@ -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"
}

View file

@ -1,4 +1,4 @@
BP_WB Version 0.1.0.001
BP_WB Version 0.0.0.001
Date: December 21, 2025
=== Latest Changes ===